-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--drop without continuing migration use case #526
Comments
I know it's kind of strange to have two db managment tool. But Im only using Entity Framework Core with OpenIddict related tables because EF can handle migration automatically. Otherwise I want use only grate and handle db calls manually with Dapper etc. |
Hi, @Jantero93 - to try to generalise a bit, how do you run your EF migrations? It looks like the recommended way from Microsoft to run EF migrations in production is to generate SQL scripts: https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/applying?tabs=dotnet-core-cli It even looks like they have some functionality similar to grate, with the Idempotent SQL scripts (same page, further down). Microsoft says in this same page:
I would recommend:
Depending on the rest of your grate scripts, where they fit in with the EF migrations, you might want to use another folder than You can customise the grate Folder configuration completely, if you want either a simpler or more complex folder structure than the default: https://erikbra.github.io/grate/folder-configuration/ |
EDIT: Tried rewrite whole post with better english
I have a use case where I need to drop a database without continuing the migration. Specifically, I have a database rebuild script that first drops the database. I want to handle creating the database with Grate (setting collation, etc.) on SQL Server.
So my flow on database rebuild
So my ultimate goal have
RebuildDatabase.sh
containining (WITH SINGLE GRATE FOLDER) something like
Now my workaround is to create set Drop & Create database script different folder and run them from master db (I can't use --drop flag, because that would trigger migrations before Entity Framework Core migrations. And when I dont use --drop, grate will not trigger scripts in dropDatabase folder)
So my current setup is something like this (example)
Then my another ultimate goal is have UpdateDatabase.sh what would contain
The text was updated successfully, but these errors were encountered: