-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.conf
21 lines (20 loc) · 831 Bytes
/
settings.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# replace the host, port, dbname, user, password with your database configurations
[Common]
conn_string : host=localhost port=5432 dbname=postgres user=postgres password=postgres
table_schema : public
exclude_views : true
exclude_tablenames_like : historical,celery,spatial_ref_sys,django,auth
output_filepath : sample_output
[SQL]
query : SELECT c.table_name, c.column_name,
c.udt_name datatype, t.table_type,
case when k.constraint_name is null then 0 else 1 end is_pk
FROM information_schema.tables t join
information_schema.columns c
on t.table_name = c.table_name left join
information_schema.key_column_usage k
on c.table_name = k.table_name
and c.column_name = k.column_name
and RIGHT(constraint_name, 4) = 'pkey'
WHERE c.table_schema = @table_schema
ORDER BY c.table_name, c.ordinal_position