EF Core Migration SQL Explainer
Paste a dotnet ef migrations script SQL output to see a grouped, plain-English summary of every change — with destructive operations flagged before you run it.
What this tool does
Paste the SQL produced by dotnet ef migrations script and this tool groups every recognizable operation into plain-English categories — tables created or dropped, columns added, altered, or dropped, indexes, foreign keys, and the __EFMigrationsHistory bookkeeping rows EF Core uses to track which migrations have run. Destructive or review-worthy operations — DROP TABLE, DROP COLUMN, ALTER COLUMN, and dropped constraints — are pulled into a warning section at the top so they're the first thing you see before running the script against a real database. It runs entirely in your Blazor Server session using a hand-written statement splitter and pattern matcher — no external SQL parser library, and nothing is sent to a separate API.
How to generate the SQL this tool expects
- Run
dotnet ef migrations scriptin your project directory to generate the full idempotent SQL for all migrations, ordotnet ef migrations script <FromMigration> <ToMigration>for a specific range. - Copy the generated SQL and paste it into the editor on the left.
- Click Explain (or Ctrl+Enter).
- Review the destructive-operations warning section first, then the grouped categories below it.
Worked example
This script:
CREATE TABLE [Orders] (
[Id] int NOT NULL IDENTITY,
[CustomerId] int NOT NULL,
[Total] decimal(18,2) NOT NULL,
CONSTRAINT [PK_Orders] PRIMARY KEY ([Id])
);
GO
ALTER TABLE [Orders] ADD [Status] nvarchar(50) NOT NULL DEFAULT N'Pending';
GO
ALTER TABLE [Orders] ADD CONSTRAINT [FK_Orders_Customers_CustomerId] FOREIGN KEY ([CustomerId]) REFERENCES [Customers] ([Id]) ON DELETE CASCADE;
GO
ALTER TABLE [Orders] DROP COLUMN [LegacyField];
GO
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES (N'20260801120000_AddOrders', N'8.0.10');
GO
produces one destructive warning for Orders.LegacyField being dropped, plus grouped entries under Tables created, Columns added, Foreign keys added, and Migration bookkeeping.
What "destructive or review-worthy" means here
DROP TABLEandDROP COLUMN— unambiguously destroy data. Always flagged.ALTER COLUMN— always flagged, because this script alone doesn't show the column's previous type. A narrower length, a changed precision, or an addedNOT NULLcan fail or truncate existing data, but that's only visible by comparing against the prior schema — something outside the scope of a single script.- Dropped constraints — flagged because a constraint name alone doesn't reveal whether it was a foreign key, primary key, or check constraint without the original migration that created it.
What this tool won't do
It does not execute the SQL, connect to a database, or validate that the script will succeed against your actual schema — it's a static classifier of statement shapes, not a SQL engine. It's written primarily against SQL Server's bracketed-identifier syntax (the default provider in most EF Core tutorials and this script's typical output); scripts from other providers with different quoting or DDL syntax will have a higher proportion of statements land in the Unclassified bucket rather than being misclassified with a guess.
Migration SQL
CREATE TABLE [Orders] (
[Id] int NOT NULL IDENTITY,
[CustomerId] int NOT NULL,
[Total] decimal(18,2) NOT NULL,
CONSTRAINT [PK_Orders] PRIMARY KEY ([Id])
);
GO
ALTER TABLE [Orders] ADD [Status] nvarchar(50) NOT NULL DEFAULT N'Pending';
GO
ALTER TABLE [Orders] ADD CONSTRAINT [FK_Orders_Customers_CustomerId] FOREIGN KEY ([CustomerId]) REFERENCES [Customers] ([Id]) ON DELETE CASCADE;
GO
ALTER TABLE [Orders] DROP COLUMN [LegacyField];
GO
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
VALUES (N'20260801120000_AddOrders', N'8.0.10');
GOPaste the SQL from dotnet ef migrations script and click Explain.