Menu

#246 (ok 3.3) Diff between two tables/databases

fixed
nobody
Utilities (45)
1
2013-06-11
2002-11-01
No

From Eric Persson:
----------------------------
Hi everyone,

Some of you might remember I asked for a structure diff
earlier, I want to compare 2 tables and get an alter
query which would make the target table to look exactly
like the original table.

I have now made a small hack which almost does this, at
least it show the idea of what I want it to be.

I added the file diff_tables.php which currently takes
?db as an get argument. It shows the table in that
database and you can pick 2 tables to compare and you
get a hopefully working alter query. :)

I modified left.php to show a link after the
num_tables, like (diff) which goes to diff_tables.php
with ?db as the database.

If you want to try it out, patch your 2.3.2 version of
phpmyadmin with the files, or visit
http://www.egp.cx/phpMyAdmin-2.3.2/ where I put up a
patched version. Please dont destroy the tables to much. :)

Some ideas of what to improve:
* maintain the order of the fields
* maintain keys/indexes and auto_increment fields
* make it possible to diff tables between databases
* make it possible to diff create table queries
* create a nice graphical view over whats
added/changed/dropped

Do you have any furhter suggestions?

Please comment and try it out and think about it. The
code is still very hacky, and I might have re-invented
the wheel in some places, but I'm not yet familiar with
all libraryfiles etc.

Best regards,
Eric

Discussion

  • Marc Delisle

    Marc Delisle - 2002-11-01

    diff_tables.php by Eric Persson

     
  • Marc Delisle

    Marc Delisle - 2002-11-01

    Logged In: YES
    user_id=210714

    Version 2:
    - hidden db variable
    - all code with .php3 extension (because our code base
    requires it)

    to maybe colorize (maybe because some users may have
    configured to not colorize):
    $parsed_sql = PMA_SQP_parse($the_query);
    $maybe_colorized = PMA_formatSql($parsed_sql);

     
  • Marc Delisle

    Marc Delisle - 2002-11-01

    Version 2 by lem9

     
  • Anonymous

    Anonymous - 2002-11-01

    Logged In: YES
    user_id=640012

    I'm currently working on the next version which will implement
    field order and key maintenance.

     
  • Marc Delisle

    Marc Delisle - 2002-12-06

    Logged In: YES
    user_id=210714

    Any news about the next version?

     
  • Garvin Hicking

    Garvin Hicking - 2003-03-05
    • labels: --> Utilities
    • status: open --> open-out-of-date
     
  • Michal Čihař

    Michal Čihař - 2003-09-08

    Logged In: YES
    user_id=192186

    Any progress here?

    I just found simmilar thing written in perl:
    http://adamspiers.org/computing/mysqldiff/

     
  • Nobody/Anonymous

    Logged In: NO

    Maybe you want to use mysqldiff (http://www.mysqldiff.org).

     
  • Olivier Mueller

    Olivier Mueller - 2004-06-02
    • priority: 5 --> 6
     
  • Olivier Mueller

    Olivier Mueller - 2004-06-02

    Logged In: YES
    user_id=15563

    hey, got exactely the same request from a coworker this
    afternoon: this would really be a nice feature...

    we could start by allowing the comparaison of tables of the
    same DB, and then expand the system to other DB/servers.

     
  • Marc Delisle

    Marc Delisle - 2008-07-26
    • priority: 6 --> 5
     
  • Michal Čihař

    Michal Čihař - 2009-03-03
    • summary: Diff between two tables --> Diff between two tables/databases
     
  • Marc Delisle

    Marc Delisle - 2010-01-03

    Implemented in 3.3 (synchronize feature).

     
  • Marc Delisle

    Marc Delisle - 2010-01-03
    • summary: Diff between two tables/databases --> (ok 3.3) Diff between two tables/databases
    • priority: 5 --> 1
    • status: open-out-of-date --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2010-03-08
    • status: open-accepted --> closed-accepted
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-accepted --> fixed
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.