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

Migrations: Script-Migration doesn't revert -From migration #6126

Closed
pamerio opened this issue Jul 21, 2016 · 3 comments
Closed

Migrations: Script-Migration doesn't revert -From migration #6126

pamerio opened this issue Jul 21, 2016 · 3 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@pamerio
Copy link

pamerio commented Jul 21, 2016

In the previous version of EF core one could use Update-Database with the option -Script to generate an SQL Script instead of updating the DB. That way I could generate the script to downgrade a bad migration.
Now the option -script has gone and I'm not sure how to get the same result.
I tried Script-Migration -From Migration2 -To Migration1 (where Migration2 is newer than Migration1) but no success.
Any hints...?

Thanks

Paolo

@bricelam
Copy link
Contributor

bricelam commented Aug 9, 2016

It looks like there is a bug (#6228) preventing migrations names form being used with Script-Migration. Does it work if you use the full migration ID?

Script-Migration -From 20160809114400_Migration2 -To 20160809112200_Migration1

@bricelam bricelam changed the title Remove Migration SQL Script Migrations: Script-Migration doesn't revert -From Aug 9, 2016
@bricelam
Copy link
Contributor

bricelam commented Aug 9, 2016

It looks like there is another issue here--the -From migration isn't reverted. Thus, if you do two consecutive migrations, the revert script is empty.

@bricelam
Copy link
Contributor

bricelam commented Aug 10, 2016

As a workaround, you can enter an arbitrary string that is ordinary greater than the desired migration e.g. 20160809114400_zzz

@divega divega added this to the 1.0.1 milestone Aug 10, 2016
@bricelam bricelam changed the title Migrations: Script-Migration doesn't revert -From Migrations: Script-Migration doesn't revert -From migration Aug 11, 2016
@bricelam bricelam added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

No branches or pull requests

5 participants