mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added ERD Diagram support with basic table fields, primary key, foreign key, and DDL SQL generation. Fixes #1802
This commit is contained in:
committed by
Akshay Joshi
parent
065bda37b4
commit
0c8226ff39
651
web/regression/javascript/erd/test_tables.js
Normal file
651
web/regression/javascript/erd/test_tables.js
Normal file
@@ -0,0 +1,651 @@
|
||||
export default [
|
||||
{
|
||||
'oid': 123456,
|
||||
'name': 'test1',
|
||||
'spcoid': 0,
|
||||
'relacl_str': null,
|
||||
'spcname': 'pg_default',
|
||||
'schema': 'schema1',
|
||||
'relowner': 'postgres',
|
||||
'relkind': 'r',
|
||||
'is_partitioned': false,
|
||||
'relhassubclass': false,
|
||||
'reltuples': '0',
|
||||
'description': null,
|
||||
'conname': null,
|
||||
'conkey': null,
|
||||
'isrepl': false,
|
||||
'triggercount': '0',
|
||||
'coll_inherits': [],
|
||||
'inherited_tables_cnt': '0',
|
||||
'relpersistence': false,
|
||||
'fillfactor': null,
|
||||
'parallel_workers': null,
|
||||
'toast_tuple_target': null,
|
||||
'autovacuum_enabled': 'x',
|
||||
'autovacuum_vacuum_threshold': null,
|
||||
'autovacuum_vacuum_scale_factor': null,
|
||||
'autovacuum_analyze_threshold': null,
|
||||
'autovacuum_analyze_scale_factor': null,
|
||||
'autovacuum_vacuum_cost_delay': null,
|
||||
'autovacuum_vacuum_cost_limit': null,
|
||||
'autovacuum_freeze_min_age': null,
|
||||
'autovacuum_freeze_max_age': null,
|
||||
'autovacuum_freeze_table_age': null,
|
||||
'toast_autovacuum_enabled': 'x',
|
||||
'toast_autovacuum_vacuum_threshold': null,
|
||||
'toast_autovacuum_vacuum_scale_factor': null,
|
||||
'toast_autovacuum_analyze_threshold': null,
|
||||
'toast_autovacuum_analyze_scale_factor': null,
|
||||
'toast_autovacuum_vacuum_cost_delay': null,
|
||||
'toast_autovacuum_vacuum_cost_limit': null,
|
||||
'toast_autovacuum_freeze_min_age': null,
|
||||
'toast_autovacuum_freeze_max_age': null,
|
||||
'toast_autovacuum_freeze_table_age': null,
|
||||
'reloptions': null,
|
||||
'toast_reloptions': null,
|
||||
'reloftype': 0,
|
||||
'typname': null,
|
||||
'typoid': null,
|
||||
'rlspolicy': false,
|
||||
'forcerlspolicy': false,
|
||||
'hastoasttable': false,
|
||||
'seclabels': null,
|
||||
'is_sys_table': false,
|
||||
'partition_scheme': '',
|
||||
'autovacuum_custom': false,
|
||||
'toast_autovacuum': false,
|
||||
'rows_cnt': 0,
|
||||
'vacuum_settings_str': '',
|
||||
'vacuum_table': [
|
||||
{
|
||||
'name': 'autovacuum_analyze_scale_factor',
|
||||
'setting': '0.1',
|
||||
'label': 'ANALYZE scale factor',
|
||||
'column_type': 'number',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_analyze_threshold',
|
||||
'setting': '50',
|
||||
'label': 'ANALYZE base threshold',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_max_age',
|
||||
'setting': '200000000',
|
||||
'label': 'FREEZE maximum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_delay',
|
||||
'setting': '2',
|
||||
'label': 'VACUUM cost delay',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_limit',
|
||||
'setting': '-1',
|
||||
'label': 'VACUUM cost limit',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_scale_factor',
|
||||
'setting': '0.2',
|
||||
'label': 'VACUUM scale factor',
|
||||
'column_type': 'number',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_threshold',
|
||||
'setting': '50',
|
||||
'label': 'VACUUM base threshold',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_min_age',
|
||||
'setting': '50000000',
|
||||
'label': 'FREEZE minimum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_table_age',
|
||||
'setting': '150000000',
|
||||
'label': 'FREEZE table age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
],
|
||||
'vacuum_toast': [
|
||||
{
|
||||
'name': 'autovacuum_freeze_max_age',
|
||||
'setting': '200000000',
|
||||
'label': 'FREEZE maximum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_delay',
|
||||
'setting': '2',
|
||||
'label': 'VACUUM cost delay',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_limit',
|
||||
'setting': '-1',
|
||||
'label': 'VACUUM cost limit',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_scale_factor',
|
||||
'setting': '0.2',
|
||||
'label': 'VACUUM scale factor',
|
||||
'column_type': 'number',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_threshold',
|
||||
'setting': '50',
|
||||
'label': 'VACUUM base threshold',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_min_age',
|
||||
'setting': '50000000',
|
||||
'label': 'FREEZE minimum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_table_age',
|
||||
'setting': '150000000',
|
||||
'label': 'FREEZE table age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
],
|
||||
'columns': [{
|
||||
'name': 'id',
|
||||
'atttypid': 23,
|
||||
'attlen': null,
|
||||
'attnum': 1,
|
||||
'attndims': 0,
|
||||
'atttypmod': -1,
|
||||
'attacl': [],
|
||||
'attnotnull': true,
|
||||
'attoptions': null,
|
||||
'attstattarget': -1,
|
||||
'attstorage': 'p',
|
||||
'attidentity': '',
|
||||
'defval': null,
|
||||
'typname': 'integer',
|
||||
'displaytypname': 'integer',
|
||||
'cltype': 'integer',
|
||||
'elemoid': 23,
|
||||
'typnspname': 'pg_catalog',
|
||||
'defaultstorage': 'p',
|
||||
'description': null,
|
||||
'indkey': '1',
|
||||
'isdup': false,
|
||||
'collspcname': '',
|
||||
'is_fk': false,
|
||||
'seclabels': null,
|
||||
'is_sys_column': false,
|
||||
'colconstype': 'n',
|
||||
'genexpr': null,
|
||||
'relname': 'tab1',
|
||||
'is_view_only': false,
|
||||
'seqrelid': null,
|
||||
'seqtypid': null,
|
||||
'seqstart': null,
|
||||
'seqincrement': null,
|
||||
'seqmax': null,
|
||||
'seqmin': null,
|
||||
'seqcache': null,
|
||||
'seqcycle': null,
|
||||
'is_pk': true,
|
||||
'is_primary_key': true,
|
||||
'attprecision': null,
|
||||
'edit_types': [
|
||||
'bigint',
|
||||
'double precision',
|
||||
'information_schema.cardinal_number',
|
||||
'integer',
|
||||
'money',
|
||||
'numeric',
|
||||
'oid',
|
||||
'real',
|
||||
'regclass',
|
||||
'regconfig',
|
||||
'regdictionary',
|
||||
'regnamespace',
|
||||
'regoper',
|
||||
'regoperator',
|
||||
'regproc',
|
||||
'regprocedure',
|
||||
'regrole',
|
||||
'regtype',
|
||||
'smallint',
|
||||
],
|
||||
}],
|
||||
'primary_key': [],
|
||||
'unique_constraint': [],
|
||||
'check_constraint': [],
|
||||
'index': {},
|
||||
'rule': {},
|
||||
'trigger': {},
|
||||
'row_security_policy': {},
|
||||
},
|
||||
{
|
||||
'oid': 408229,
|
||||
'name': 'test2',
|
||||
'spcoid': 0,
|
||||
'relacl_str': null,
|
||||
'spcname': 'pg_default',
|
||||
'schema': 'erd',
|
||||
'relowner': 'postgres',
|
||||
'relkind': 'r',
|
||||
'is_partitioned': false,
|
||||
'relhassubclass': false,
|
||||
'reltuples': '0',
|
||||
'description': null,
|
||||
'conname': 'tab1_pkey',
|
||||
'conkey': [
|
||||
1,
|
||||
],
|
||||
'isrepl': false,
|
||||
'triggercount': '0',
|
||||
'coll_inherits': [],
|
||||
'inherited_tables_cnt': '0',
|
||||
'relpersistence': false,
|
||||
'fillfactor': null,
|
||||
'parallel_workers': null,
|
||||
'toast_tuple_target': null,
|
||||
'autovacuum_enabled': 'x',
|
||||
'autovacuum_vacuum_threshold': null,
|
||||
'autovacuum_vacuum_scale_factor': null,
|
||||
'autovacuum_analyze_threshold': null,
|
||||
'autovacuum_analyze_scale_factor': null,
|
||||
'autovacuum_vacuum_cost_delay': null,
|
||||
'autovacuum_vacuum_cost_limit': null,
|
||||
'autovacuum_freeze_min_age': null,
|
||||
'autovacuum_freeze_max_age': null,
|
||||
'autovacuum_freeze_table_age': null,
|
||||
'toast_autovacuum_enabled': 'x',
|
||||
'toast_autovacuum_vacuum_threshold': null,
|
||||
'toast_autovacuum_vacuum_scale_factor': null,
|
||||
'toast_autovacuum_analyze_threshold': null,
|
||||
'toast_autovacuum_analyze_scale_factor': null,
|
||||
'toast_autovacuum_vacuum_cost_delay': null,
|
||||
'toast_autovacuum_vacuum_cost_limit': null,
|
||||
'toast_autovacuum_freeze_min_age': null,
|
||||
'toast_autovacuum_freeze_max_age': null,
|
||||
'toast_autovacuum_freeze_table_age': null,
|
||||
'reloptions': null,
|
||||
'toast_reloptions': null,
|
||||
'reloftype': 0,
|
||||
'typname': null,
|
||||
'typoid': null,
|
||||
'rlspolicy': false,
|
||||
'forcerlspolicy': false,
|
||||
'hastoasttable': false,
|
||||
'seclabels': null,
|
||||
'is_sys_table': false,
|
||||
'partition_scheme': '',
|
||||
'autovacuum_custom': false,
|
||||
'toast_autovacuum': false,
|
||||
'rows_cnt': 0,
|
||||
'vacuum_settings_str': '',
|
||||
'vacuum_table': [
|
||||
{
|
||||
'name': 'autovacuum_analyze_scale_factor',
|
||||
'setting': '0.1',
|
||||
'label': 'ANALYZE scale factor',
|
||||
'column_type': 'number',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_analyze_threshold',
|
||||
'setting': '50',
|
||||
'label': 'ANALYZE base threshold',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_max_age',
|
||||
'setting': '200000000',
|
||||
'label': 'FREEZE maximum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_delay',
|
||||
'setting': '2',
|
||||
'label': 'VACUUM cost delay',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_limit',
|
||||
'setting': '-1',
|
||||
'label': 'VACUUM cost limit',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_scale_factor',
|
||||
'setting': '0.2',
|
||||
'label': 'VACUUM scale factor',
|
||||
'column_type': 'number',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_threshold',
|
||||
'setting': '50',
|
||||
'label': 'VACUUM base threshold',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_min_age',
|
||||
'setting': '50000000',
|
||||
'label': 'FREEZE minimum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_table_age',
|
||||
'setting': '150000000',
|
||||
'label': 'FREEZE table age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
],
|
||||
'vacuum_toast': [
|
||||
{
|
||||
'name': 'autovacuum_freeze_max_age',
|
||||
'setting': '200000000',
|
||||
'label': 'FREEZE maximum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_delay',
|
||||
'setting': '2',
|
||||
'label': 'VACUUM cost delay',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_cost_limit',
|
||||
'setting': '-1',
|
||||
'label': 'VACUUM cost limit',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_scale_factor',
|
||||
'setting': '0.2',
|
||||
'label': 'VACUUM scale factor',
|
||||
'column_type': 'number',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_vacuum_threshold',
|
||||
'setting': '50',
|
||||
'label': 'VACUUM base threshold',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_min_age',
|
||||
'setting': '50000000',
|
||||
'label': 'FREEZE minimum age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
{
|
||||
'name': 'autovacuum_freeze_table_age',
|
||||
'setting': '150000000',
|
||||
'label': 'FREEZE table age',
|
||||
'column_type': 'integer',
|
||||
},
|
||||
],
|
||||
'columns': [
|
||||
{
|
||||
'name': 'id',
|
||||
'atttypid': 23,
|
||||
'attlen': null,
|
||||
'attnum': 1,
|
||||
'attndims': 0,
|
||||
'atttypmod': -1,
|
||||
'attacl': [],
|
||||
'attnotnull': true,
|
||||
'attoptions': null,
|
||||
'attstattarget': -1,
|
||||
'attstorage': 'p',
|
||||
'attidentity': '',
|
||||
'defval': null,
|
||||
'typname': 'integer',
|
||||
'displaytypname': 'integer',
|
||||
'cltype': 'integer',
|
||||
'elemoid': 23,
|
||||
'typnspname': 'pg_catalog',
|
||||
'defaultstorage': 'p',
|
||||
'description': null,
|
||||
'indkey': '1',
|
||||
'isdup': false,
|
||||
'collspcname': '',
|
||||
'is_fk': false,
|
||||
'seclabels': null,
|
||||
'is_sys_column': false,
|
||||
'colconstype': 'n',
|
||||
'genexpr': null,
|
||||
'relname': 'tab1',
|
||||
'is_view_only': false,
|
||||
'seqrelid': null,
|
||||
'seqtypid': null,
|
||||
'seqstart': null,
|
||||
'seqincrement': null,
|
||||
'seqmax': null,
|
||||
'seqmin': null,
|
||||
'seqcache': null,
|
||||
'seqcycle': null,
|
||||
'is_pk': true,
|
||||
'is_primary_key': true,
|
||||
'attprecision': null,
|
||||
'edit_types': [
|
||||
'bigint',
|
||||
'double precision',
|
||||
'information_schema.cardinal_number',
|
||||
'integer',
|
||||
'money',
|
||||
'numeric',
|
||||
'oid',
|
||||
'real',
|
||||
'regclass',
|
||||
'regconfig',
|
||||
'regdictionary',
|
||||
'regnamespace',
|
||||
'regoper',
|
||||
'regoperator',
|
||||
'regproc',
|
||||
'regprocedure',
|
||||
'regrole',
|
||||
'regtype',
|
||||
'smallint',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'col1col1col1col1col1col1col1col1',
|
||||
'atttypid': 23,
|
||||
'attlen': null,
|
||||
'attnum': 2,
|
||||
'attndims': 0,
|
||||
'atttypmod': -1,
|
||||
'attacl': [],
|
||||
'attnotnull': true,
|
||||
'attoptions': null,
|
||||
'attstattarget': -1,
|
||||
'attstorage': 'p',
|
||||
'attidentity': '',
|
||||
'defval': null,
|
||||
'typname': 'integer',
|
||||
'displaytypname': 'integer',
|
||||
'cltype': 'integer',
|
||||
'elemoid': 23,
|
||||
'typnspname': 'pg_catalog',
|
||||
'defaultstorage': 'p',
|
||||
'description': null,
|
||||
'indkey': '1',
|
||||
'isdup': false,
|
||||
'collspcname': '',
|
||||
'is_fk': true,
|
||||
'seclabels': null,
|
||||
'is_sys_column': false,
|
||||
'colconstype': 'n',
|
||||
'genexpr': null,
|
||||
'relname': 'tab1',
|
||||
'is_view_only': false,
|
||||
'seqrelid': null,
|
||||
'seqtypid': null,
|
||||
'seqstart': null,
|
||||
'seqincrement': null,
|
||||
'seqmax': null,
|
||||
'seqmin': null,
|
||||
'seqcache': null,
|
||||
'seqcycle': null,
|
||||
'is_pk': false,
|
||||
'is_primary_key': false,
|
||||
'attprecision': null,
|
||||
'edit_types': [
|
||||
'bigint',
|
||||
'double precision',
|
||||
'information_schema.cardinal_number',
|
||||
'integer',
|
||||
'integer',
|
||||
'money',
|
||||
'numeric',
|
||||
'oid',
|
||||
'real',
|
||||
'regclass',
|
||||
'regconfig',
|
||||
'regdictionary',
|
||||
'regnamespace',
|
||||
'regoper',
|
||||
'regoperator',
|
||||
'regproc',
|
||||
'regprocedure',
|
||||
'regrole',
|
||||
'regtype',
|
||||
'smallint',
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'col2',
|
||||
'atttypid': 23,
|
||||
'attlen': null,
|
||||
'attnum': 3,
|
||||
'attndims': 0,
|
||||
'atttypmod': -1,
|
||||
'attacl': [],
|
||||
'attnotnull': false,
|
||||
'attoptions': null,
|
||||
'attstattarget': -1,
|
||||
'attstorage': 'p',
|
||||
'attidentity': '',
|
||||
'defval': null,
|
||||
'typname': 'integer',
|
||||
'displaytypname': 'integer',
|
||||
'cltype': 'integer',
|
||||
'elemoid': 23,
|
||||
'typnspname': 'pg_catalog',
|
||||
'defaultstorage': 'p',
|
||||
'description': null,
|
||||
'indkey': '1',
|
||||
'isdup': false,
|
||||
'collspcname': '',
|
||||
'is_fk': false,
|
||||
'seclabels': null,
|
||||
'is_sys_column': false,
|
||||
'colconstype': 'n',
|
||||
'genexpr': null,
|
||||
'relname': 'tab1',
|
||||
'is_view_only': false,
|
||||
'seqrelid': null,
|
||||
'seqtypid': null,
|
||||
'seqstart': null,
|
||||
'seqincrement': null,
|
||||
'seqmax': null,
|
||||
'seqmin': null,
|
||||
'seqcache': null,
|
||||
'seqcycle': null,
|
||||
'is_pk': false,
|
||||
'is_primary_key': false,
|
||||
'attprecision': null,
|
||||
'edit_types': [
|
||||
'bigint',
|
||||
'double precision',
|
||||
'information_schema.cardinal_number',
|
||||
'integer',
|
||||
'integer',
|
||||
'integer',
|
||||
'money',
|
||||
'numeric',
|
||||
'oid',
|
||||
'real',
|
||||
'regclass',
|
||||
'regconfig',
|
||||
'regdictionary',
|
||||
'regnamespace',
|
||||
'regoper',
|
||||
'regoperator',
|
||||
'regproc',
|
||||
'regprocedure',
|
||||
'regrole',
|
||||
'regtype',
|
||||
'smallint',
|
||||
],
|
||||
},
|
||||
],
|
||||
'primary_key': [
|
||||
{
|
||||
'oid': 408232,
|
||||
'name': 'tab1_pkey',
|
||||
'col_count': 1,
|
||||
'spcname': 'pg_default',
|
||||
'comment': null,
|
||||
'condeferrable': false,
|
||||
'condeferred': false,
|
||||
'fillfactor': null,
|
||||
'columns': [
|
||||
{
|
||||
'column': 'id',
|
||||
},
|
||||
],
|
||||
'include': [],
|
||||
},
|
||||
],
|
||||
'unique_constraint': [],
|
||||
'foreign_key': [
|
||||
{
|
||||
'oid': 408239,
|
||||
'name': 'tab1_col1_fkey',
|
||||
'condeferrable': false,
|
||||
'condeferred': false,
|
||||
'confupdtype': 'a',
|
||||
'confdeltype': 'a',
|
||||
'confmatchtype': false,
|
||||
'conkey': [
|
||||
2,
|
||||
],
|
||||
'confkey': [
|
||||
1,
|
||||
],
|
||||
'confrelid': 408234,
|
||||
'fknsp': 'erd',
|
||||
'fktab': 'tab1',
|
||||
'refnsp': 'erd',
|
||||
'reftab': 'tab2',
|
||||
'comment': null,
|
||||
'convalidated': false,
|
||||
'columns': [
|
||||
{
|
||||
'local_column': 'col1col1col1col1col1col1col1col1',
|
||||
'references': 123456,
|
||||
'referenced': 'id',
|
||||
'references_table_name': 'schema1.test1',
|
||||
},
|
||||
],
|
||||
'remote_schema': 'schema1',
|
||||
'remote_table': 'test1',
|
||||
'coveringindex': null,
|
||||
'autoindex': true,
|
||||
'hasindex': false,
|
||||
},
|
||||
],
|
||||
'check_constraint': [],
|
||||
'index': {},
|
||||
'rule': {},
|
||||
'trigger': {},
|
||||
'row_security_policy': {},
|
||||
},
|
||||
];
|
||||
Reference in New Issue
Block a user