Reputation: 174
After adding migrations in a code first approach, when i need to apply changes to production database (postgresql 13), i need to generate script for those changes.
script-migration
from microsoft docs generates sql script for SQL Server. but i need it for postgresql. there is an online tool that converts SQL server script to Postgresql but introduces errors. Is there a way to produce postgresql script automatically? As i am not very confident with postgresql syntax.
Upvotes: 5
Views: 3247
Reputation: 174
Shay Rojansky from the npgsql team mentioned "The typical way is to maintain a set of migrations for each provider, and at that point you can generate SQL migration scripts for the provider you want." This link https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/providers?tabs=dotnet-core-cli provides the details for using multiple providers. And i was missing the --project and --provider parameters when adding migrations and i needed to maintain a set of migrations for each provider. And in case you have only one provider enabled (with one db context) like this, scipt-migration command will create script for it.
Upvotes: 1