F
F
fantgeass2012-08-09 08:32:40
MySQL
fantgeass, 2012-08-09 08:32:40

Automatic synchronization of MySQL database structure?

I have two databases on localhost. One for the site, the other for the test environment of this site.

Is there any way, tool to automatically synchronize the structure of the database?

I know about the “Structure Synchronization” feature of Navicat, but it doesn’t suit me that with every change in the database, synchronization must be done manually.

-
Not finding the proper tool, I decided to roll migrations to two databases at once.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
W
Wott, 2012-08-09
@Wott

It's a stupid idea to set up replication and turn on the log manually only for DDL commands SET SQL_LOG_BIN=1
But in general it's somehow wrong. I do so that the test environment is recoverable, that is, there is somewhere a base fill that I use to initialize before running the tests. Accordingly, it can be divided into a schema and data, and a schema can be taken from production by export. Either the scheme is in the VCS entirely for this build or in the form of patches.

E
EugeneOZ, 2012-08-09
@EugeneOZ

Can be done with Export -> ALTER in MySQL Workbench. Not automatically, of course, but not writing code manually is already a plus.
In DbSchema, all changes that are made to the schema are immediately made to the database (but you can also work offline). There is also a synchronization button - it compares both databases, shows the differences, and you can choose where to update. Don't write code either.

A
AntonioK, 2012-08-09
@AntonioK

Change the structure of the database only by rolling patch files with alters. Files sync to any VCS. Roll them manually as needed or automatically using a deploy script.

J
Jo_mikoliev, 2022-03-10
@Jo_mikoliev

I think there are several tools that do this, but not automatically (I don't think it's a good idea to do this automatically). For example, with ERBuilder, after a few modifications on my 2nd database, I run a sync, it compares the two schemas, and it generates a SQL script for me that I run on my first database.
6229e5fb87ee8809995174.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question