Friday, 15 April 2011

entity framework - Code first deploy on production -


prod on my DP PC copy of DB and address I

The production I saw in the system table Had the 8 migration records exist in _MigrationHistory (the first version of the code was written and posted by another person).

I need to add some new tables and codes to work with them - models and controllers. I can add new models for the new tables and code for the controller.

> Options-database "Script" With Options

and without executing it on the output to get the table in my DEV DB and script.

I bin folder and Prod to deploy to run the SQL script to create new tables in the need to copy the contents of the new ideas and DB.

I was thinking that this is sufficient because at the moment I see records for all the migrations in related records in my Dev environment in the production environment in system tables _MigrationHistory

If I only PROD But if I run SQL Script then a new record for this operation can not be seen in _MigrationHistory. It may be possible to separate the model to get an error and deploy it. Be a problem after. Before making changes to the production database, make sure that you have a full backup.

I was wondering if it is enough for me at the moment I see the same kind of record production environment records all migration in your dev environment system table - _MigrationHistory

If you run the code in your development environment, then your explicit migration will apply.

If I understand your comment correctly, then you are in Migration and PROD in Dev itself. If this is true, then the prod may be up-to-date.

Look in your project in your Migration folder. There you will see a complete list of migrations, each one in their .cs file (and related .Designer.cs and .resx files). <<< p>

If I only run SQL Script, you can run SQL Script on the output. A new record for this action can not be seen in _MigrationHistory

Take a look at your migration script and enter the appropriate entry in __MigrationHistory where they participate (including the output). Here is an example of one of my projects:

INSERT [dbo]. [__ Migration History] ([Maigreshnaidi], [Sndrbkaini], [model], [Utpadwarsn]) value (N'201409082209285_VDisposer ', N'Survey.Model.Migrations.MembershipConfiguration.MembershipConfiguration', 0x1F8B0800000 ... 1A0200, N ' 6.1.1-30610 ')

it is possible that one reason that the model is to receive the error is different and

Any problem after deployment Maybe, if you are getting an error that the model does not match the database, then there is another reason.

  • Backup your production database.
  • Restore it in your DEV environment (use a different name from your normal DEV database, or backup your DEV database first if using a different name, temporarily web.config Remember to change to a new database.)
  • Create a new migration.
  • See the code ready for the new migration. It tells you what is in Prod and what position God is in.
  • After configuring your web, remember to undo the change.


    No comments:

    Post a Comment