Skip to content

More streamlined workflow for early stage app development #3053

Description

@axefrog

While developing a new app, nobody's using my local database other than me, so the only migration I need is the initial one. The process involves writing some code, blowing away the old state of the database and associated migrations, then generating new ones and applying them back to the database. It sure would be nice to be able to do this literally in one step.

e.g. Something like dnx ef rebuild-all and have it destroy the existing migrations, unapply them from the database, generate new migrations and apply those to the database.

Activity

  1. davidfowl commented on Sep 8, 2015

    @davidfowl
    Member

    I'm going to +1 this 😄

  2. ErikEJ commented on Sep 8, 2015

    @ErikEJ
    Contributor

    Could you use the existing:

     context.Database.EnsureCreated();
     context.Database.EnsureDeleted();
    
  3. axefrog commented on Sep 8, 2015

    @axefrog
    Author

    Those aren't command line options though...?

  4. ErikEJ commented on Sep 8, 2015

    @ErikEJ
    Contributor

    No, those are code, so you never need to fall out to the command line

  5. anpete commented on Sep 8, 2015

    @anpete
    Contributor

    @bricelam Is it possible for someone to make a .cmd file to do this now, using the existing commands?

  6. bricelam commented on Sep 8, 2015

    @bricelam
    Contributor

    Hmm, we don't expose any commands for the APIs Erik mentioned, but we have #2476 on the Backlog.

    But I suppose you could, yes:

    # Revert all migrations
    dnx ef database update 0
    
    # Remove last migration
    dnx ef migrations remove
    
    # Re-scaffold migaration
    dnx ef migrations add InitialCreate
    
    # Apply migration
    dnx ef database update
  7. anpete commented on Sep 8, 2015

    @anpete
    Contributor

    @bricelam Thanks! That's what I meant.

  8. rowanmiller commented on Sep 9, 2015

    @rowanmiller
    Contributor

    EF Team Triage: Obviously there are some details of implementation to iron out, but we do agree that this scenario would be good to improve. Moving to the backlog as we will look at it after our initial RTM.

  9. added this to the Backlog milestone on Sep 9, 2015
  10. self-assigned this
    on Nov 9, 2017
  11. murbanowicz commented on Nov 9, 2017

    @murbanowicz

    Any updates on that?
    Take a look at Java Hibernate... Just set update strategy and it's done... At the moment with net.core it's painful with every change of db with code first approach

  12. removed their assignment
    on Oct 12, 2018
  13. 15 remaining items

  14. kaptcha0 commented on Mar 15, 2022

    @kaptcha0
  15. modified the milestones: 7.0.0, Backlog on Apr 23, 2022
  16. removed their assignment
    on Jul 8, 2023
  17. added theissue type on Jun 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions