if use fluentmigrator with postgres it generate code like this
CREATE TABLE public."Sample"...
because of this i must use double quotes for every sequence
SELECT * FROM public.Sample <--- Error
SELECT * FROM public."Sample" <--- OK
How i can turn off double quoter?
more informating description https://github.com/schambers/fluentmigrator/issues/687
I've had a look at this myself and the issue is that FluentMigrator has the quotes hard coded in basically..... as per the current version.
The only way forward is to download and modify the source code yourself.
Its pretty well made you'll need to look a the PostgresQuoter.cs class for example and override some of the base quoting methods.
I haven't completely modded the whole project, only works on the first pass and hope to complete the rest of the changes later this week. If it isn't too hacky i'll see if can't give you the files to modify.
In latest version 3.3.2 you can disable the quoting via PostgresOptions
"Force Quote" parameter, which annoyingly defaults to 'true' but can be toggled off.
Argument for the dotnet fm
tool to turn the behavior off:
--processor-switches "Force Quote=false"
See https://github.com/fluentmigrator/fluentmigrator/blob/v3.3.2/src/FluentMigrator.Runner.Postgres/Processors/Postgres/PostgresOptions.cs
https://fluentmigrator.github.io/articles/runners/dotnet-fm.html#-s--processor-switches-processor_switches
The same can be done with the "in-process" approach by setting ProcessorOptions
on the IDBMigrationRunner instance while configuring the runner:
Small snippet:
return new ServiceCollection()
.AddFluentMigratorCore()
.ConfigureRunner(rb => rb
.AddPostgres()
// ...
.ConfigureGlobalProcessorOptions(opt =>
{
opt.ProviderSwitches = "Force Quote=false";
})
// ...
For context see:
https://fluentmigrator.github.io/articles/migration-runners.html?tabs=vs-pkg-manager-console
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With