Thread: pgAdmin 4 commit: Added Schema Diff tool to compare two schemas and gen
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 <khushboo.vashi@enterprisedb.com> 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(-)
Re: pgAdmin 4 commit: Added Schema Diff tool to compare two schemasand gen
From
Murtuza Zabuawala
Date:
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,
On Fri, Jan 10, 2020 at 3:42 PM Akshay Joshi <akshay.joshi@enterprisedb.com> 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 <khushboo.vashi@enterprisedb.com>
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(-)