MySQL Forums
Forum List  »  MySQL for Visual Studio

Re: EF6 Code First with MySQL
Posted by: Gabriela Martinez Sanchez
Date: November 25, 2014 03:10PM

Hi Gabriel,
Since the database is already created you need to change a little bit the steps.

Please do the following:


1.- Remove the existing Migrations folder in your project if there is any, and DROP the table "__MigrationHistory" from the existing database.
2.- Run the "enable-migrations" command from the Package Manager Console.
3.- Run the "add-migration" command to create an initial migration.
4.- Remove all of the code in the Up() method for the initial migration.
5.- Run the "update-database" command to apply the initial migration to your database. This doesn't make any changes to existing objects, but it marks the existing database as having been migrated to the initial state.
6.- Make changes to your code-first model.
7.- Run the "add-migration" command to create a new migration. The code in the Up() method of the new migration will contain only the changes to your object model.
Run the "update-database" command to apply the changes to your database.

Please give it a try and let me know if this worked.

Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
3238
November 13, 2014 01:21AM
1398
November 13, 2014 01:36AM
2193
November 18, 2014 02:17AM
Re: EF6 Code First with MySQL
1788
November 25, 2014 03:10PM
1110
November 26, 2014 07:56AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.