-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Implement database locking for migrations #33731
Comments
That's a good idea - databases do frequently expose locking mechanisms that could work well, e.g. full-table exclusive lock on the HistoryRepository table for PG and SQL Server. Though I'm not sure what a default implementation would look like here - what do you have in mind with the temporary table? |
Before applying migrations create |
PG tracking issue: npgsql/efcore.pg#3223 |
Generally speaking, concurrent invocations of
Migrate()
will fail and possibly leave the database in a corrupted state. In order to mitigate this, we could create a temporary table usingHistoryRepository
that will serve as a lock while the migrations are applied by the process that acquired it. Providers will be able to override all related logic to instead leverage database-specific mechanisms to accomplish this.The text was updated successfully, but these errors were encountered: