As the job area getting bigger and bigger, new tables created and others table get normalize. It’s often to see adding field or remove some field from table.
Development phase also take some place and different computer. Need more time to get ‘whats new‘ in table structure.
An illustration for example :
Working to make database for book application. Location for developing are in the office and house. This example will show how to get table diff for table at home versus office table.
Database test1 (at office) already have table named ‘book‘.
Structure of this table contains :
id (Int 11), auto increment
book_name (varchar 100)
book_author (varchar 100)
I dump this structure for my computer at home. At home I made database test2.
I add a few field in this table, at the end I came up with this table structure :
before I know sqlyog I manually write down every field I add or remove. When the table increase in quality and quantity I can’t use manual way.
I Need table diff.
To get table diff in sqlyog for this example , here’s the steps :
1. Make new database ( in computer office )
2. Dump newest structure ( made at home ) to database created in step 1.
3. Open Sqlyog to start make diff.
Make sure database test1 and test2 exist.
Click on ‘Powertools‘ -> Structure Synchronization Tool
Selection of database for first host and second host is depend on requirement, in this case I use database test2 as first host and database test1 as second host because database test2 contain table with newer structure. Your case is vary.
Hit Compare Now button to get start.
Click ‘Sync (File)… >>" button to save table diff . I save it to My Document.
Double click diff file to see its content.
/* Alter table in Second database */
alter table `test1`.`book`,
add column `book_review` text NULL after `book_author`,
add column `book_isbn` varchar(25) NULL after `book_review`,
add column `book_price` decimal(5,2) NULL after `book_isbn`;
This sql query is exactly what I need, Just copy and paste this sql to phpmyadmin SQL window section then my work at home get synchronized.
Very neat tool.
SqlYog Highly recommended