Skip to content
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

Make migration Designer file, specifically BuildTargetModel, optional #34276

Closed
Suchiman opened this issue Jul 23, 2024 · 2 comments
Closed

Make migration Designer file, specifically BuildTargetModel, optional #34276

Suchiman opened this issue Jul 23, 2024 · 2 comments

Comments

@Suchiman
Copy link
Contributor

Suchiman commented Jul 23, 2024

Our database model is quite large which results in a model snapshot of 1.5MB. Everytime someone adds another migration, this gets duplicated into the MyMigration.Designer.cs file inside the BuildTargetModel method. Not only does this add megabytes to git, it also significantly impacts compile times, IDE performance and deployment size (the 1.5MB increase in source file result in about 500kb increase in assembly size). This has lead to rationing of migrations and frequent migration squashing which is quite a time sink.

As far as i can tell, the designer file is only really needed to perform Remove-Migration. As we are using version control, and so should every respectable software shop, it would be nice to have at least an opt-in to disable generating that Designer file.

For some numbers:
The migration snapshot is 39792 lines long.
We have currently 46 migrations, totalling 72.7MB in the migrations folder, that were created since the last migration squash 4 months ago.
The database.dll (only DbContext + DbModels + Migrations) without migrations (but with model snapshot) takes 7s to build and results in an 3.493kb assembly. With the 46 migrations, build time is 34s and assembly size grows to 26.162kb.

@roji
Copy link
Member

roji commented Jul 23, 2024

Duplicate of #18620

@roji roji marked this as a duplicate of #18620 Jul 23, 2024
@roji
Copy link
Member

roji commented Jul 23, 2024

See also #2174 - between these two issues this has been discussed quite extensively.

@roji roji closed this as not planned Won't fix, can't repro, duplicate, stale Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants