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.
This commit is contained in:
Khushboo Vashi
2020-01-10 15:39:32 +05:30
committed by Akshay Joshi
parent 8b99a33e6e
commit 45f2e35a99
87 changed files with 10727 additions and 402 deletions

View File

@@ -84,6 +84,8 @@ define('tools.querytool', [
this.handler.preferences = this.preferences;
this.connIntervalId = null;
this.layout = opts.layout;
this.set_server_version(opts.server_ver);
this.trigger('pgadmin-sqleditor:view:initialised');
},
// Bind all the events
@@ -2318,6 +2320,12 @@ define('tools.querytool', [
}
},
set_value_to_editor: function(query) {
if (this.gridView && this.gridView.query_tool_obj && !_.isUndefined(query)) {
this.gridView.query_tool_obj.setValue(query);
}
},
init_events: function() {
var self = this;
// Listen to the file manager button events

View File

@@ -4,5 +4,5 @@ SELECT at.attname, at.attnum, ty.typname
FROM pg_attribute at LEFT JOIN pg_type ty ON (ty.oid = at.atttypid)
WHERE attrelid={{obj_id}}::oid AND attnum = ANY (
(SELECT con.conkey FROM pg_class rel LEFT OUTER JOIN pg_constraint con ON con.conrelid=rel.oid
AND con.contype='p' WHERE rel.relkind IN ('r','s','t') AND rel.oid = {{obj_id}}::oid)::oid[])
AND con.contype='p' WHERE rel.relkind IN ('r','s','t') AND rel.oid = ({{obj_id}})::oid)::oid[])
{% endif %}

View File

@@ -35,12 +35,13 @@ def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
column_types[col['name']] = col_type
if not is_query_tool:
col_type['not_null'] = col['not_null'] = \
rset['rows'][key]['not_null']
if key in rset['rows']:
col_type['not_null'] = col['not_null'] = \
rset['rows'][key]['not_null']
col_type['has_default_val'] = \
col['has_default_val'] = \
rset['rows'][key]['has_default_val']
col_type['has_default_val'] = \
col['has_default_val'] = \
rset['rows'][key]['has_default_val']
else:
for row in rset['rows']: