I have recently upgraded Asp.Net Identity V1.0 to V2.0. Because of this, in Identity database few more columns get added like Email, IsEmailConfirmed etc. without any data loss.
I like to know is there any way to downgrade from Asp.Net Identity V2.0 to V1.0 without any data loss.
I have tired many ways but I am not able to retrieve Identity V1.0 database without data loss. Have spend nearly 3 days in search of good tutorial/blog for downgrading activity but not able to find one.
Any help much appreciated.
No source control or backups I assume?
One thing you could possibly do is use code first migrations:
1) Open an Identity Version 1 of your solution. If you can't find one, just do a new project with Identity Version 1.
2) From the console, enable-migrations
then add-migration -IgnoreChanges initialIdentity1
followed by update-database
. This will create a migration with a snapshot of the current database state.
3) Upgrade to Identity 2.
4) From the console, add-migration identity2update
followed by update-database
. This will create a migration with the differences including a method called Down()
that will contain the information needed to move backwards.
5) Generate a script that can be used to move backwards:
update-database -Script -TargetMigration initialIdentity1
6) Apply that script to your database and downgrade the Nuget Identity package.
Now make a backup and add your code to source control :)