Thread: Login Support
View Single Post
  #2  
Old 03-07-2017, 10:25 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Anything is possible with a 2-year old database.

If you load the two database together, you can use a query like this to help sort out table differences:
Code:
SELECT 'peq_test', `TABLE_NAME` FROM `information_schema`.`TABLES` a WHERE a.`TABLE_SCHEMA` = 'peq_test' AND a.`TABLE_NAME` NOT IN
(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = 'peq') UNION
SELECT 'peq', `TABLE_NAME` FROM `information_schema`.`TABLES` b WHERE b.`TABLE_SCHEMA` = 'peq' AND b.`TABLE_NAME` NOT IN
(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = 'peq_test');
They don't have to be named the same as what's in the query..just make sure you change the names in the query to whatever you use.

NOTE: They should check against each other (i.e., `peq` not in `peq_test` and vice verse..)


If you need a more in-depth query - like to check columns in each table - let me know and I'll see what I can do.


EDIT:

This appears to work ok for table/column differences..

Code:
SELECT 'peq_test', `TABLE_NAME`, `COLUMN_NAME` FROM `information_schema`.`COLUMNS` a WHERE a.`TABLE_SCHEMA` = 'peq_test' AND (a.`TABLE_NAME` NOT IN
(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = 'peq') OR (a.`COLUMN_NAME` NOT IN
(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = 'peq' AND `TABLE_NAME` = a.`TABLE_NAME`))) UNION
SELECT 'peq', `TABLE_NAME`, `COLUMN_NAME` FROM `information_schema`.`COLUMNS` b WHERE b.`TABLE_SCHEMA` = 'peq' AND (b.`TABLE_NAME` NOT IN
(SELECT `TABLE_NAME` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = 'peq_test') OR (b.`COLUMN_NAME` NOT IN
(SELECT `COLUMN_NAME` FROM `information_schema`.`COLUMNS` WHERE `TABLE_SCHEMA` = 'peq_test' AND `TABLE_NAME` = b.`TABLE_NAME`)));
..but, it is VERY EXPENSIVE to use.
__________________
Uleat of Bertoxxulous

Compilin' Dirty

Last edited by Uleat; 03-07-2017 at 10:55 PM..
Reply With Quote