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

Long term situation of migration files #14038

Closed
Kurira opened this issue Nov 29, 2018 · 2 comments
Closed

Long term situation of migration files #14038

Kurira opened this issue Nov 29, 2018 · 2 comments
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported

Comments

@Kurira
Copy link

Kurira commented Nov 29, 2018

We have a project large project maintained by 5+ developers and we started noticing that our deployment packages are getting bigger and bigger. In our investigation we found out that every new migration creates a <MigrationName>.Designer.cs file which includes the whole context snapshot in it (currently 15k lines).

Is this by design? Every migration includes a heavy 15k+ lines commit and our project dll is at 21MB with over 1 million lines just in migration files. I don't see this scaling after 1-2 years of active development.
We would probably have 50-100MB dll. What's the scenario here? Deleting old migrations, because new ones include the latest snapshot anyway?

@bricelam
Copy link
Contributor

bricelam commented Nov 29, 2018

How do you use the migrations? Do you use the them at runtime, or are they just used during development and deployment? Are there multiple versions of the application/database schema deployed into production at the same time? Do new devs need to re-create the database locally using migrations?

@bricelam
Copy link
Contributor

bricelam commented Nov 29, 2018

Some possibilities:

  • You can keep the migrations in a separate assembly that doesn't get deployed.
  • You can create two migration sets--one for development and one for releases. The one for releases would presumably be smaller than the one for development.
  • We don't have tooling for it yet (Squash migrations #2174), but you can combine/squash older migrations together into a single migration.
  • Taking squashing to the extreme, you can delete all the migrations and start fresh. After deleting them, create a new one, comment out the contents of the Up method, run Update-Database to mark the migration as applied, uncomment the Up method so new devs can still create the database.

@ajcvickers ajcvickers added closed-no-further-action The issue is closed and no further action is planned. customer-reported labels Dec 3, 2018
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-no-further-action The issue is closed and no further action is planned. customer-reported
Projects
None yet
Development

No branches or pull requests

3 participants