2 ms·
Visual Studio can also help automate running EF Migrations scripts, you just provide a Connection String under EF Migrations settings in the Publish settings.
by WorldMaker 7y ago
Visual Studio can also help automate running EF Migrations scripts, you just provide a Connection String under EF Migrations settings in the Publish settings.
What it does under the hood is also relatively easy to script or automate in other places. It builds a script artifact using:
dotnet ef migrations script --idempotent
That gives you a "run anywhere" SQL Server T-SQL Script (I don't think it supports other databases) that will run any migrations that don't exist in the target database (and is safe if the target database is already up to date).
Then it's just a matter of running that script on the right database.