Re: pgAdmin 4 commit: Added Schema Diff tool to compare two schemas and gen
Murtuza Zabuawala <[email protected]> Mon, 13 Jan 2020 14:50:53 +0530
| Newsgroups | gmane.comp.db.postgresql.pgadmin.devel |
|---|---|
| Message-ID | <CAKKotZRu4=n4CSwV11UKLpt1uEmTpD3CAtWt6fDvHqWurZvwHw@mail.gmail.com> |
--000000000000ea82c0059c01fe57 Content-Type: text/plain; charset="UTF-8" Hi Khushboo, We can create a common function in Server node to fetch the servers and then use that same function in the schema diff tool, currently we have written the same function in schema diff tool to avoid duplicate code. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Fri, Jan 10, 2020 at 3:42 PM Akshay Joshi <[email protected]> wrote: > Added Schema Diff tool to compare two schemas and generate the difference > script. > > Currently supported objects are Table, View, Materialized View, Function > and Procedure. > > Backend comparison of two schemas implemented by: Akshay Joshi > > Fixes #3452. > > Branch > ------ > master > > Details > ------- > > https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=45f2e35a99ee691d67c45982211238b8ad40d7de > Author: Khushboo Vashi <[email protected]> > > Modified Files > -------------- > docs/en_US/release_notes_4_18.rst | 1 + > .../browser/server_groups/servers/__init__.py | 2 + > .../server_groups/servers/databases/__init__.py | 3 + > .../servers/databases/schemas/__init__.py | 2 + > .../databases/schemas/collations/__init__.py | 65 +- > .../servers/databases/schemas/domains/__init__.py | 79 +- > .../domains/sql/9.2_plus/get_constraints.sql | 2 +- > .../domains/sql/default/get_constraints.sql | 2 +- > .../databases/schemas/foreign_tables/__init__.py | 116 +-- > .../schemas/fts_configurations/__init__.py | 59 +- > .../databases/schemas/fts_dictionaries/__init__.py | 59 +- > .../databases/schemas/fts_parsers/__init__.py | 69 +- > .../databases/schemas/fts_templates/__init__.py | 70 +- > .../databases/schemas/functions/__init__.py | 92 ++- > .../servers/databases/schemas/packages/__init__.py | 105 ++- > .../schemas/packages/edbfuncs/__init__.py | 5 +- > .../databases/schemas/packages/edbvars/__init__.py | 5 +- > .../databases/schemas/sequences/__init__.py | 61 +- > .../servers/databases/schemas/synonyms/__init__.py | 64 +- > .../servers/databases/schemas/tables/__init__.py | 192 ++++- > .../databases/schemas/tables/columns/__init__.py | 1 + > .../schemas/tables/compound_triggers/__init__.py | 142 +++- > .../tables/constraints/index_constraint/utils.py | 4 +- > .../databases/schemas/tables/indexes/__init__.py | 204 ++++- > .../databases/schemas/tables/indexes/utils.py | 15 +- > .../schemas/tables/partitions/__init__.py | 183 ++++- > .../databases/schemas/tables/rules/__init__.py | 127 +++- > .../databases/schemas/tables/schema_diff_utils.py | 507 +++++++++++++ > .../templates/columns/sql/10_plus/create.sql | 2 +- > .../templates/columns/sql/10_plus/update.sql | 12 +- > .../templates/columns/sql/12_plus/create.sql | 2 +- > .../templates/columns/sql/9.2_plus/update.sql | 10 +- > .../templates/columns/sql/default/create.sql | 2 +- > .../templates/columns/sql/default/update.sql | 14 +- > .../templates/partitions/sql/pg/10_plus/create.sql | 1 + > .../templates/tables/sql/10_plus/schema_diff.sql | 14 + > .../databases/schemas/tables/triggers/__init__.py | 116 ++- > .../databases/schemas/tables/triggers/utils.py | 17 +- > .../servers/databases/schemas/tables/utils.py | 113 ++- > .../servers/databases/schemas/types/__init__.py | 61 +- > .../servers/databases/schemas/utils.py | 148 ++-- > .../servers/databases/schemas/views/__init__.py | 227 +++++- > .../templates/views/pg/9.2_plus/sql/update.sql | 2 +- > .../templates/views/pg/9.3_plus/sql/update.sql | 2 +- > .../templates/views/pg/9.4_plus/sql/update.sql | 2 +- > .../databases/templates/databases/css/database.css | 5 + > web/pgadmin/static/bundle/slickgrid.js | 3 + > web/pgadmin/static/js/backform.pgadmin.js | 9 +- > .../static/scss/resources/_default.variables.scss | 7 + > .../tools/datagrid/static/js/show_query_tool.js | 19 + > .../tools/datagrid/templates/datagrid/index.html | 9 + > web/pgadmin/tools/schema_diff/__init__.py | 601 +++++++++++++++ > web/pgadmin/tools/schema_diff/compare.py | 212 ++++++ > web/pgadmin/tools/schema_diff/directory_compare.py | 279 +++++++ > web/pgadmin/tools/schema_diff/model.py | 76 ++ > web/pgadmin/tools/schema_diff/node_registry.py | 61 ++ > .../tools/schema_diff/static/css/schema_diff.css | 189 +++++ > .../tools/schema_diff/static/img/compare-white.svg | 15 + > .../tools/schema_diff/static/img/compare.svg | 15 + > .../tools/schema_diff/static/img/script.svg | 19 + > .../schema_diff/static/js/schema_diff.backform.js | 500 ++++++++++++ > .../tools/schema_diff/static/js/schema_diff.js | 145 ++++ > .../schema_diff/static/js/schema_diff_hook.js | 38 + > .../tools/schema_diff/static/js/schema_diff_ui.js | 845 > +++++++++++++++++++++ > .../schema_diff/static/scss/_schema_diff.scss | 85 +++ > .../schema_diff/templates/schema_diff/index.html | 31 + > web/pgadmin/tools/schema_diff/tests/__init__.py | 0 > .../tools/schema_diff/tests/pg/10_plus/source.sql | 440 +++++++++++ > .../tools/schema_diff/tests/pg/10_plus/target.sql | 429 +++++++++++ > .../tools/schema_diff/tests/pg/11_plus/source.sql | 439 +++++++++++ > .../tools/schema_diff/tests/pg/11_plus/target.sql | 428 +++++++++++ > .../tools/schema_diff/tests/pg/12_plus/source.sql | 440 +++++++++++ > .../tools/schema_diff/tests/pg/12_plus/target.sql | 417 ++++++++++ > .../tools/schema_diff/tests/pg/9.2_plus/source.sql | 311 ++++++++ > .../tools/schema_diff/tests/pg/9.2_plus/target.sql | 337 ++++++++ > .../schema_diff/tests/ppas/10_plus/source.sql | 376 +++++++++ > .../schema_diff/tests/ppas/10_plus/target.sql | 364 +++++++++ > .../schema_diff/tests/ppas/9.2_plus/source.sql | 311 ++++++++ > .../schema_diff/tests/ppas/9.2_plus/target.sql | 337 ++++++++ > .../schema_diff/tests/test_schema_diff_comp.py | 204 +++++ > web/pgadmin/tools/schema_diff/tests/utils.py | 103 +++ > web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 8 + > .../sqleditor/sql/default/primary_keys.sql | 2 +- > .../tools/sqleditor/utils/get_column_types.py | 11 +- > web/pgadmin/utils/csrf.py | 2 + > web/webpack.config.js | 4 +- > web/webpack.shim.js | 2 + > 87 files changed, 10717 insertions(+), 392 deletions(-) > > --000000000000ea82c0059c01fe57 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div di= r=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"lt= r"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_d= efault" style=3D"font-family:verdana,sans-serif"><font color=3D"#444444">Hi= Khushboo,</font></div><div class=3D"gmail_default" style=3D"font-family:ve= rdana,sans-serif"><font color=3D"#444444"><br></font></div><div class=3D"gm= ail_default" style=3D"font-family:verdana,sans-serif"><font color=3D"#44444= 4">We can create a common=C2=A0function in Server node to fetch=C2=A0the se= rvers and then use that same function in the schema diff tool, currently we= have written the same function in schema diff tool to avoid duplicate code= .</font></div><div class=3D"gmail_default" style=3D"font-family:verdana,san= s-serif"><br></div><div class=3D"gmail_default" style=3D"font-family:verdan= a,sans-serif;color:rgb(68,68,68)"><br></div><div><div dir=3D"ltr" class=3D"= gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"lt= r"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><= div dir=3D"ltr"><font size=3D"2" face=3D"verdana, sans-serif" color=3D"#444= 444">--</font><div><font size=3D"2" face=3D"verdana, sans-serif" color=3D"#= 444444">Regards,</font><div><font size=3D"2"><font face=3D"verdana, sans-se= rif" color=3D"#444444">Murtuza Zabuawala<br>EnterpriseDB:=C2=A0<a href=3D"h= ttp://www.enterprisedb.com/" rel=3D"noreferrer" target=3D"_blank">http://ww= w.enterprisedb.com</a><br>The Enterprise PostgreSQL Company</font></font></= div></div><div><font size=3D"2"><font face=3D"verdana, sans-serif" color=3D= "#444444"><br></font></font></div></div></div></div></div></div></div></div= ></div></div></div></div></div></div></div></div><br></div><br><div class= =3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Jan 10, 2020= at 3:42 PM Akshay Joshi <<a href=3D"mailto:[email protected]= m">[email protected]</a>> wrote:<br></div><blockquote class= =3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;bo= rder-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">= Added Schema Diff tool to compare=C2=A0two schemas and generate the differe= nce script.<br> <br> Currently=C2=A0supported objects are Table, View, Materialized View, Functi= on and Procedure.<br> <br> Backend comparison of two schemas implemented by: Akshay Joshi<br> <br> Fixes #3452.<br> <br> Branch<br> ------<br> master<br> <br> Details<br> -------<br> <a href=3D"https://git.postgresql.org/gitweb?p=3Dpgadmin4.git;a=3Dcommitdif= f;h=3D45f2e35a99ee691d67c45982211238b8ad40d7de" rel=3D"noreferrer" target= =3D"_blank">https://git.postgresql.org/gitweb?p=3Dpgadmin4.git;a=3Dcommitdi= ff;h=3D45f2e35a99ee691d67c45982211238b8ad40d7de</a><br> Author: Khushboo Vashi <<a href=3D"mailto:[email protected]= m" target=3D"_blank">[email protected]</a>><br> <br> Modified Files<br> --------------<br> docs/en_US/release_notes_4_18.rst=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A01 +<br> .../browser/server_groups/servers/__init__.py=C2=A0 =C2=A0 =C2=A0 |=C2=A0 = =C2=A02 +<br> .../server_groups/servers/databases/__init__.py=C2=A0 =C2=A0 |=C2=A0 =C2=A0= 3 +<br> .../servers/databases/schemas/__init__.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 =C2=A02 +<br> .../databases/schemas/collations/__init__.py=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 65 +-<br> .../servers/databases/schemas/domains/__init__.py=C2=A0 |=C2=A0 79 +-<br> .../domains/sql/9.2_plus/get_constraints.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 =C2=A02 +-<br> .../domains/sql/default/get_constraints.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 =C2=A02 +-<br> .../databases/schemas/foreign_tables/__init__.py=C2=A0 =C2=A0| 116 +--<br> .../schemas/fts_configurations/__init__.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0|=C2=A0 59 +-<br> .../databases/schemas/fts_dictionaries/__init__.py |=C2=A0 59 +-<br> .../databases/schemas/fts_parsers/__init__.py=C2=A0 =C2=A0 =C2=A0 |=C2=A0 6= 9 +-<br> .../databases/schemas/fts_templates/__init__.py=C2=A0 =C2=A0 |=C2=A0 70 +-<= br> .../databases/schemas/functions/__init__.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 92 ++-<br> .../servers/databases/schemas/packages/__init__.py | 105 ++-<br> <span class=3D"gmail_default" style=3D"font-family:verdana,sans-serif;color= :rgb(68,68,68)"></span>.../schemas/packages/edbfuncs/__init__.py=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A05 +-<br> .../databases/schemas/packages/edbvars/__init__.py |=C2=A0 =C2=A05 +-<br> .../databases/schemas/sequences/__init__.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 61 +-<br> .../servers/databases/schemas/synonyms/__init__.py |=C2=A0 64 +-<br> .../servers/databases/schemas/tables/__init__.py=C2=A0 =C2=A0| 192 ++++-<br= > .../databases/schemas/tables/columns/__init__.py=C2=A0 =C2=A0|=C2=A0 =C2=A0= 1 +<br> .../schemas/tables/compound_triggers/__init__.py=C2=A0 =C2=A0| 142 +++-<br> .../tables/constraints/index_constraint/utils.py=C2=A0 =C2=A0|=C2=A0 =C2=A0= 4 +-<br> .../databases/schemas/tables/indexes/__init__.py=C2=A0 =C2=A0| 204 ++++-<br= > .../databases/schemas/tables/indexes/utils.py=C2=A0 =C2=A0 =C2=A0 |=C2=A0 1= 5 +-<br> .../schemas/tables/partitions/__init__.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= | 183 ++++-<br> .../databases/schemas/tables/rules/__init__.py=C2=A0 =C2=A0 =C2=A0| 127 +++= -<br> .../databases/schemas/tables/schema_diff_utils.py=C2=A0 | 507 +++++++++++++= <br> .../templates/columns/sql/10_plus/create.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 =C2=A02 +-<br> .../templates/columns/sql/10_plus/update.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 12 +-<br> .../templates/columns/sql/12_plus/create.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 =C2=A02 +-<br> .../templates/columns/sql/9.2_plus/update.sql=C2=A0 =C2=A0 =C2=A0 |=C2=A0 1= 0 +-<br> .../templates/columns/sql/default/create.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 =C2=A02 +-<br> .../templates/columns/sql/default/update.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 14 +-<br> .../templates/partitions/sql/pg/10_plus/create.sql |=C2=A0 =C2=A01 +<br> .../templates/tables/sql/10_plus/schema_diff.sql=C2=A0 =C2=A0|=C2=A0 14 +<b= r> .../databases/schemas/tables/triggers/__init__.py=C2=A0 | 116 ++-<br> .../databases/schemas/tables/triggers/utils.py=C2=A0 =C2=A0 =C2=A0|=C2=A0 1= 7 +-<br> .../servers/databases/schemas/tables/utils.py=C2=A0 =C2=A0 =C2=A0 | 113 ++-= <br> .../servers/databases/schemas/types/__init__.py=C2=A0 =C2=A0 |=C2=A0 61 +-<= br> .../servers/databases/schemas/utils.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| 148 ++--<br> .../servers/databases/schemas/views/__init__.py=C2=A0 =C2=A0 | 227 +++++-<b= r> .../templates/views/pg/9.2_plus/sql/update.sql=C2=A0 =C2=A0 =C2=A0|=C2=A0 = =C2=A02 +-<br> .../templates/views/pg/9.3_plus/sql/update.sql=C2=A0 =C2=A0 =C2=A0|=C2=A0 = =C2=A02 +-<br> .../templates/views/pg/9.4_plus/sql/update.sql=C2=A0 =C2=A0 =C2=A0|=C2=A0 = =C2=A02 +-<br> .../databases/templates/databases/css/database.css |=C2=A0 =C2=A05 +<br> web/pgadmin/static/bundle/slickgrid.js=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0|=C2=A0 =C2=A03 +<br> web/pgadmin/static/js/backform.pgadmin.js=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= |=C2=A0 =C2=A09 +-<br> .../static/scss/resources/_default.variables.scss=C2=A0 |=C2=A0 =C2=A07 +<b= r> .../tools/datagrid/static/js/show_query_tool.js=C2=A0 =C2=A0 |=C2=A0 19 +<b= r> .../tools/datagrid/templates/datagrid/index.html=C2=A0 =C2=A0|=C2=A0 =C2=A0= 9 +<br> web/pgadmin/tools/schema_diff/__init__.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= | 601 +++++++++++++++<br> web/pgadmin/tools/schema_diff/compare.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0| 212 ++++++<br> web/pgadmin/tools/schema_diff/directory_compare.py | 279 +++++++<br> web/pgadmin/tools/schema_diff/model.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0|=C2=A0 76 ++<br> web/pgadmin/tools/schema_diff/node_registry.py=C2=A0 =C2=A0 =C2=A0|=C2=A0 6= 1 ++<br> .../tools/schema_diff/static/css/schema_diff.css=C2=A0 =C2=A0| 189 +++++<br= > .../tools/schema_diff/static/img/compare-white.svg |=C2=A0 15 +<br> .../tools/schema_diff/static/img/compare.svg=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2= =A0 15 +<br> .../tools/schema_diff/static/img/script.svg=C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2= =A0 19 +<br> .../schema_diff/static/js/schema_diff.backform.js=C2=A0 | 500 ++++++++++++<= br> .../tools/schema_diff/static/js/schema_diff.js=C2=A0 =C2=A0 =C2=A0| 145 +++= +<br> .../schema_diff/static/js/schema_diff_hook.js=C2=A0 =C2=A0 =C2=A0 |=C2=A0 3= 8 +<br> .../tools/schema_diff/static/js/schema_diff_ui.js=C2=A0 | 845 +++++++++++++= ++++++++<br> .../schema_diff/static/scss/_schema_diff.scss=C2=A0 =C2=A0 =C2=A0 |=C2=A0 8= 5 +++<br> .../schema_diff/templates/schema_diff/index.html=C2=A0 =C2=A0|=C2=A0 31 +<b= r> web/pgadmin/tools/schema_diff/tests/__init__.py=C2=A0 =C2=A0 |=C2=A0 =C2=A0= 0<br> .../tools/schema_diff/tests/pg/10_plus/source.sql=C2=A0 | 440 +++++++++++<b= r> .../tools/schema_diff/tests/pg/10_plus/target.sql=C2=A0 | 429 +++++++++++<b= r> .../tools/schema_diff/tests/pg/11_plus/source.sql=C2=A0 | 439 +++++++++++<b= r> .../tools/schema_diff/tests/pg/11_plus/target.sql=C2=A0 | 428 +++++++++++<b= r> .../tools/schema_diff/tests/pg/12_plus/source.sql=C2=A0 | 440 +++++++++++<b= r> .../tools/schema_diff/tests/pg/12_plus/target.sql=C2=A0 | 417 ++++++++++<br= > .../tools/schema_diff/tests/pg/9.2_plus/source.sql | 311 ++++++++<br> .../tools/schema_diff/tests/pg/9.2_plus/target.sql | 337 ++++++++<br> .../schema_diff/tests/ppas/10_plus/source.sql=C2=A0 =C2=A0 =C2=A0 | 376 +++= ++++++<br> .../schema_diff/tests/ppas/10_plus/target.sql=C2=A0 =C2=A0 =C2=A0 | 364 +++= ++++++<br> .../schema_diff/tests/ppas/9.2_plus/source.sql=C2=A0 =C2=A0 =C2=A0| 311 +++= +++++<br> .../schema_diff/tests/ppas/9.2_plus/target.sql=C2=A0 =C2=A0 =C2=A0| 337 +++= +++++<br> .../schema_diff/tests/test_schema_diff_comp.py=C2=A0 =C2=A0 =C2=A0| 204 +++= ++<br> web/pgadmin/tools/schema_diff/tests/utils.py=C2=A0 =C2=A0 =C2=A0 =C2=A0| 10= 3 +++<br> web/pgadmin/tools/sqleditor/static/js/sqleditor.js |=C2=A0 =C2=A08 +<br> .../sqleditor/sql/default/primary_keys.sql=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0|=C2=A0 =C2=A02 +-<br> .../tools/sqleditor/utils/get_column_types.py=C2=A0 =C2=A0 =C2=A0 |=C2=A0 1= 1 +-<br> web/pgadmin/utils/csrf.py=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A02 +<br> web/webpack.config.js=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A04 +-<br> web/webpack.shim.js=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A02 +<b= r> 87 files changed, 10717 insertions(+), 392 deletions(-)<br> <br> </blockquote></div></div></div></div></div></div></div></div></div></div></= div></div> --000000000000ea82c0059c01fe57--