Fixes #22 -- Use `gitlab-psql -c "\dS *"` to list tables/columns
Fixes #22 (closed) -- Instead of running gitlab-rake db:schema:dump
which apparently was having some problems, instead use gitlab-psql
directly and sed
to rip out just the tables and their columns. Somebody with better sed-fu can probably exclude the trailing "Indexes" lines. Also this won't include tables without any indexes, but I imagine most if not all have a primary key.
Most of the code has been shamelessly stolen from @katrinleinweber's previous MR.
Not sure if this runs afoul of the previous issue that was occurring when using db:schema:dump, so please review with that in mind. Locally on a fresh gitlab docker image this runs in 10 seconds. The output looks like:
Table "public.zentao_tracker_data"
Column | Type | Collation | Nullable | Default
---------------------------------+--------------------------+-----------+----------+-------------------------------------------------
id | bigint | | not null | nextval('zentao_tracker_data_id_seq'::regclass)
integration_id | bigint | | not null |
created_at | timestamp with time zone | | not null |
updated_at | timestamp with time zone | | not null |
encrypted_url | bytea | | |
encrypted_url_iv | bytea | | |
encrypted_api_url | bytea | | |
encrypted_api_url_iv | bytea | | |
encrypted_zentao_product_xid | bytea | | |
encrypted_zentao_product_xid_iv | bytea | | |
encrypted_api_token | bytea | | |
encrypted_api_token_iv | bytea | | |
Indexes:
Table "public.zoom_meetings"
Column | Type | Collation | Nullable | Default
--------------+--------------------------+-----------+----------+-------------------------------------------
id | bigint | | not null | nextval('zoom_meetings_id_seq'::regclass)
project_id | bigint | | not null |
issue_id | bigint | | not null |
created_at | timestamp with time zone | | not null |
updated_at | timestamp with time zone | | not null |
issue_status | smallint | | not null | 1
url | character varying(255) | | |
Indexes: