Database structure alignment, re-initial data alignment method __ Database

Source: Internet
Author: User
Tags svn

In the company project, I am fortunate to be responsible for the production of "Upgrade scripts." Upgrade script, no doubt two steps, first structure comparison, and then the initial data alignment.

First, the structure comparison

The structure is relatively simple, using the navicat for MySQL tool, "tools"-"Structure Synchronization", select the "source", "target", "Alignment Options", click "Alignment." (If you need to upgrade the database V4 to V5)

Copy the SQL statement that synchronizes the structure, as shown in the following figure

Second, data synchronization

Right-click "Select All", "Run Query", achieve structure synchronization, then need data alignment.

In the project, as the development progresses, the initial data may change, such as the refactoring of the permission module and the addition of new features.

Navicat for MySQL has "data synchronization", but cannot display "data alignment" to produce SQL statements.

2.1 Manual Comparison

Very helpless, using the project SVN submitted SQL version number comparison, right click "Compare Revisions"

Perhaps because I have a large SQL script file, the following unexpected situation occurs:

On the Internet to check some information, found that there is a "beyond compare" text compared to the tool, feel the same as SVN's comparison. Download Address: http://www.scootersoftware.com/download.php

2.2 Auto Comparison

After the bitter-forced comparison, complete the task. I try to find this kind of software again. Found a red Gate company MySQL compare (including MySQL data Compare) software to meet my basic requirements, unfortunately, there are garbled, for example, in my SQL script, Chinese compared to the "???." The latest version of the software is 2012 and no one is maintaining upgrades. Foreigners also have such confusion, give up.

Download Address: http://www.red-gate.com/products/mysql/mysql-compare/

The surprise is, finally found a satisfactory software tool---dbforge Compare Bundle for MySQL, download address: http://www.devart.com/downloads.html

This software is very similar to the MySQL compare, for often with Navicat for MySQL friend is very simple, compare, click Sync.

Create a script file and open it using the built-in editor

The refreshing SQL script comes out and is simply manually modified to suit the needs of the project.

Finally, combining transactions, write stored procedures.

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.