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

Improve Migrations Projects #19694

Open
Tracked by #19587 ...
bricelam opened this issue Jan 24, 2020 · 5 comments
Open
Tracked by #19587 ...

Improve Migrations Projects #19694

bricelam opened this issue Jan 24, 2020 · 5 comments

Comments

@bricelam
Copy link
Contributor

Today, a lot of people end up deploying all of their migrations with their app. If they're applying those migrations as part of deployment, they just sit there taking up space.

We could introduce a new kind of project just for migrations. After creating the project, calling dotnet ef migrations add would add new migrations to this separate project keeping them out of your app. The result of building this project could even be a migrations bundle (see #19693).

@bricelam bricelam self-assigned this Jan 24, 2020
@bricelam
Copy link
Contributor Author

Open design questions:

  • How do we configure the migrations assembly?
    • Users would need to select the context/startup assembly in the new project wizard
      • We'd need to add a reference between the projects
      • We'd need to configure the migrations assembly
        • We could us Roslyn to modify OnConifuring/AddDbContext
        • We could add an assembly-level attribute to the DbContext project
    • Add-Migration might need some changes
      • Invoking it on either project should only add files to the migrations project
      • How do we find the DbContext from the migrations project on the first migration? A new assembly-level attribute could work

@AndriySvyryd

This comment was marked as outdated.

@glen-84
Copy link

glen-84 commented Sep 15, 2023

How does this differ from Using a Separate Migrations Project?

@bricelam
Copy link
Contributor Author

@glen-84 It's basically just adding conventions, sugar, and better tooling to make that easier.

@AndriySvyryd
Copy link
Member

With some additional work migrations projects can integrate well with Aspire.

However, there's currently no good way of creating a development dependency on a project, tracked by NuGet/Home#10907

@AndriySvyryd AndriySvyryd changed the title Migrations Projects Improve Migrations Projects May 17, 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

4 participants