Lakes ABP-Migrating Codefirst databases after system release [original]

Source: Internet
Author: User

In the course of project development, it is often encountered when the project is released and changes the database. How is it easy to migrate a database?

The following steps directly list the actions:

1. post the modified app :

Update the latest version of the app to the target machine. The updated file certainly does not include the database.

When you run the app, an error message appears:

Models that support the "Abpzerotemplatedbcontext" context have changed since the database was created. Consider migrating the update database using Code first

Indicates that our database needs to be updated.

2. Copy Migration Tool :

Copy the Migrate.exe under our project folder to the target machine.

SOURCE files: < Project folders >\packages\EntityFramework.< version >\tools\migrate.exe, such as C:\project-Epmp\packages\ Entityframework.6.1.3\tools\migrate.exe
Target directory: < publish folder >\bin, such as D:\project-Epmp\publish\bin
Target Machine Bin directory, there should be files EntityFramework.dll, etc.

3. execute the Migration command :

At the command prompt, execute the following command (database connection takes SQL Server as an example)

Migrate.exe xxx.yyy.entityframework.dll/connectionstring="server=localhost;database= database name; user= user name; password= user password;  "/connectionprovidername="System.Data.SqlClient "


If the execution goes smoothly, the "Applying display migration ..." will be displayed. and other information.

Well, it's the end of the migration.

After you open the updated app, it should work.

Lakes ABP-Migrating Codefirst databases after system release [original]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.