diff --git a/.github/workflows/dbdocs.yml b/.github/workflows/dbdocs.yml new file mode 100644 index 000000000..e75f7cc21 --- /dev/null +++ b/.github/workflows/dbdocs.yml @@ -0,0 +1,44 @@ +# This workflow generates database documentation and ERD files. +# +name: Generate dbdocs + +on: + pull_request: + paths: + - .github/workflows/dbdocs.yml + - db/migrations/bcda + - db/migrations/bcda_queue + +env: + VAULT_PW: ${{ secrets.VAULT_PW }} + +jobs: + generate-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.ref }} + + - name: Decrypt secrets + run: | + echo $VAULT_PW > .vault_password + bash ops/secrets --decrypt + mv -fv shared_files/encrypted/* shared_files/decrypted/ + + - name: Start DB + run: make reset-db + + - name: Generate DB docs + run: make dbdocs + + - uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4 + with: + add: dbdocs + message: "Generate dbdocs" + default_author: github_actions + + - name: Cleanup secrets + if: always() + run: rm -r shared_files/decrypted shared_files/encrypted .vault_password diff --git a/Makefile b/Makefile index 509027827..6c735614b 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ test: $(MAKE) postman env=local maintenanceMode="" $(MAKE) smoke-test env=local maintenanceMode="" -load-fixtures: +reset-db: # Rebuild the databases to ensure that we're starting in a fresh state docker compose -f docker-compose.yml rm -fsv db queue @@ -106,6 +106,7 @@ load-fixtures: docker run --rm -v ${PWD}/db/migrations:/migrations --network bcda-app-net migrate/migrate -path=/migrations/bcda/ -database 'postgres://postgres:toor@db:5432/bcda?sslmode=disable&x-migrations-table=schema_migrations_bcda' up docker run --rm -v ${PWD}/db/migrations:/migrations --network bcda-app-net migrate/migrate -path=/migrations/bcda_queue/ -database 'postgres://postgres:toor@queue:5432/bcda_queue?sslmode=disable&x-migrations-table=schema_migrations_bcda_queue' up +load-fixtures: reset-db docker compose run db psql -v ON_ERROR_STOP=1 "postgres://postgres:toor@db:5432/bcda?sslmode=disable" -f /var/db/fixtures.sql $(MAKE) load-synthetic-cclf-data $(MAKE) load-synthetic-suppression-data @@ -189,7 +190,7 @@ bdt: -e SECRET='${CLIENT_SECRET}' \ bdt -.PHONY: api-shell debug-api debug-worker docker-bootstrap docker-build lint load-fixtures load-fixtures-ssas load-synthetic-cclf-data load-synthetic-suppression-data package performance-test postman release smoke-test test unit-test worker-shell bdt unit-test-db unit-test-db-snapshot +.PHONY: api-shell debug-api debug-worker docker-bootstrap docker-build lint load-fixtures load-fixtures-ssas load-synthetic-cclf-data load-synthetic-suppression-data package performance-test postman release smoke-test test unit-test worker-shell bdt unit-test-db unit-test-db-snapshot reset-db dbdocs documentation: docker compose up --build documentation @@ -201,6 +202,9 @@ credentials: # For example: ACO_CMS_ID=A9993 make credentials @docker compose run --rm api sh -c 'bcda reset-client-credentials --cms-id $(ACO_CMS_ID)'|tail -n2 +dbdocs: + docker run --rm -v $PWD:/work -w /work --network bcda-app-net ghcr.io/k1low/tbls doc --rm-dist "postgres://postgres:toor@db:5432/bcda?sslmode=disable" dbdocs/bcda + docker run --rm -v $PWD:/work -w /work --network bcda-app-net ghcr.io/k1low/tbls doc --force "postgres://postgres:toor@queue:5432/bcda_queue?sslmode=disable" dbdocs/bcda_queue # ==== Lambda ==== diff --git a/dbdocs/bcda/README.md b/dbdocs/bcda/README.md new file mode 100644 index 000000000..828e6915d --- /dev/null +++ b/dbdocs/bcda/README.md @@ -0,0 +1,30 @@ +# bcda + +## Tables + +| Name | Columns | Comment | Type | +| ---- | ------- | ------- | ---- | +| [public.schema_migrations_bcda](public.schema_migrations_bcda.md) | 2 | | BASE TABLE | +| [public.acos](public.acos.md) | 10 | | BASE TABLE | +| [public.cclf_beneficiaries](public.cclf_beneficiaries.md) | 7 | | BASE TABLE | +| [public.cclf_files](public.cclf_files.md) | 10 | | BASE TABLE | +| [public.job_keys](public.job_keys.md) | 7 | | BASE TABLE | +| [public.jobs](public.jobs.md) | 9 | | BASE TABLE | +| [public.suppression_files](public.suppression_files.md) | 6 | | BASE TABLE | +| [public.suppressions](public.suppressions.md) | 18 | | BASE TABLE | +| [public.alr](public.alr.md) | 12 | | BASE TABLE | +| [public.alr_meta](public.alr_meta.md) | 5 | | BASE TABLE | + +## Stored procedures and functions + +| Name | ReturnType | Arguments | Type | +| ---- | ------- | ------- | ---- | +| public.trigger_set_timestamp | trigger | | FUNCTION | + +## Relations + +![er](schema.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.acos.md b/dbdocs/bcda/public.acos.md new file mode 100644 index 000000000..2bc861ced --- /dev/null +++ b/dbdocs/bcda/public.acos.md @@ -0,0 +1,46 @@ +# public.acos + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| uuid | uuid | | false | [public.jobs](public.jobs.md) | | | +| name | text | | false | | | | +| created_at | timestamp with time zone | now() | false | | | | +| updated_at | timestamp with time zone | now() | false | | | | +| id | integer | nextval('acos_id_seq'::regclass) | false | | | | +| client_id | text | | true | | | | +| cms_id | varchar(8) | | true | | | | +| group_id | text | | true | | | | +| system_id | text | | true | | | | +| termination_details | jsonb | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| acos_pkey | PRIMARY KEY | PRIMARY KEY (uuid) | +| acos_cms_id_key | UNIQUE | UNIQUE (cms_id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| acos_pkey | CREATE UNIQUE INDEX acos_pkey ON public.acos USING btree (uuid) | +| acos_cms_id_key | CREATE UNIQUE INDEX acos_cms_id_key ON public.acos USING btree (cms_id) | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.acos FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.acos.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.acos.svg b/dbdocs/bcda/public.acos.svg new file mode 100644 index 000000000..5ccc2b5c4 --- /dev/null +++ b/dbdocs/bcda/public.acos.svg @@ -0,0 +1,96 @@ + + + + + + +public.acos + + + +public.acos + + +public.acos +     +[BASE TABLE] + +uuid +[uuid] + +name +[text] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +id +[integer] + +client_id +[text] + +cms_id +[varchar(8)] + +group_id +[text] + +system_id +[text] + +termination_details +[jsonb] + + + + +public.jobs + + +public.jobs +     +[BASE TABLE] + +id     +[integer] + +aco_id     +[uuid] + +request_url     +[text] + +status     +[text] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +job_count     +[integer] + +transaction_time     +[timestamp with time zone] + +priority     +[integer] + + + +public.jobs:aco_id->public.acos:uuid + + +FOREIGN KEY (aco_id) REFERENCES acos(uuid) + + + diff --git a/dbdocs/bcda/public.alr.md b/dbdocs/bcda/public.alr.md new file mode 100644 index 000000000..beac1acfe --- /dev/null +++ b/dbdocs/bcda/public.alr.md @@ -0,0 +1,40 @@ +# public.alr + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| created_at | timestamp with time zone | now() | false | | | | +| updated_at | timestamp with time zone | now() | false | | | | +| id | bigint | nextval('alr_id_seq'::regclass) | false | | | | +| metakey | bigint | | false | | [public.alr_meta](public.alr_meta.md) | | +| mbi | character(11) | | false | | | | +| hic | character(12) | | true | | | | +| firstname | varchar(30) | | true | | | | +| lastname | varchar(40) | | true | | | | +| sex | character(1) | | true | | | | +| dob | timestamp without time zone | | true | | | | +| dod | timestamp without time zone | | true | | | | +| keyvalue | bytea | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| foreign_key_alr | FOREIGN KEY | FOREIGN KEY (metakey) REFERENCES alr_meta(id) ON UPDATE RESTRICT ON DELETE RESTRICT | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.alr FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.alr.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.alr.svg b/dbdocs/bcda/public.alr.svg new file mode 100644 index 000000000..ff6f957ef --- /dev/null +++ b/dbdocs/bcda/public.alr.svg @@ -0,0 +1,90 @@ + + + + + + +public.alr + + + +public.alr + + +public.alr +     +[BASE TABLE] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +id +[bigint] + +metakey +[bigint] + +mbi +[character(11)] + +hic +[character(12)] + +firstname +[varchar(30)] + +lastname +[varchar(40)] + +sex +[character(1)] + +dob +[timestamp without time zone] + +dod +[timestamp without time zone] + +keyvalue +[bytea] + + + + +public.alr_meta + + +public.alr_meta +     +[BASE TABLE] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +id     +[bigint] + +aco     +[varchar(5)] + +timestp     +[timestamp with time zone] + + + +public.alr:metakey->public.alr_meta:id + + +FOREIGN KEY (metakey) REFERENCES alr_meta(id) ON UPDATE RESTRICT ON DELETE RESTRICT + + + diff --git a/dbdocs/bcda/public.alr_meta.md b/dbdocs/bcda/public.alr_meta.md new file mode 100644 index 000000000..a3a60852f --- /dev/null +++ b/dbdocs/bcda/public.alr_meta.md @@ -0,0 +1,42 @@ +# public.alr_meta + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| created_at | timestamp with time zone | now() | false | | | | +| updated_at | timestamp with time zone | now() | false | | | | +| id | bigint | nextval('alr_meta_id_seq'::regclass) | false | [public.alr](public.alr.md) | | | +| aco | varchar(5) | | true | | | | +| timestp | timestamp with time zone | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| alr_meta_id_aco_timestp_key | UNIQUE | UNIQUE (id, aco, timestp) | +| primary_key_alr_meta | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| alr_meta_id_aco_timestp_key | CREATE UNIQUE INDEX alr_meta_id_aco_timestp_key ON public.alr_meta USING btree (id, aco, timestp) | +| idx_metaid_timestamp | CREATE INDEX idx_metaid_timestamp ON public.alr_meta USING btree (aco, timestp) | +| primary_key_alr_meta | CREATE UNIQUE INDEX primary_key_alr_meta ON public.alr_meta USING btree (id) | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.alr_meta FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.alr_meta.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.alr_meta.svg b/dbdocs/bcda/public.alr_meta.svg new file mode 100644 index 000000000..c7e259e0e --- /dev/null +++ b/dbdocs/bcda/public.alr_meta.svg @@ -0,0 +1,90 @@ + + + + + + +public.alr_meta + + + +public.alr_meta + + +public.alr_meta +     +[BASE TABLE] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +id +[bigint] + +aco +[varchar(5)] + +timestp +[timestamp with time zone] + + + + +public.alr + + +public.alr +     +[BASE TABLE] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +id     +[bigint] + +metakey     +[bigint] + +mbi     +[character(11)] + +hic     +[character(12)] + +firstname     +[varchar(30)] + +lastname     +[varchar(40)] + +sex     +[character(1)] + +dob     +[timestamp without time zone] + +dod     +[timestamp without time zone] + +keyvalue     +[bytea] + + + +public.alr:metakey->public.alr_meta:id + + +FOREIGN KEY (metakey) REFERENCES alr_meta(id) ON UPDATE RESTRICT ON DELETE RESTRICT + + + diff --git a/dbdocs/bcda/public.cclf_beneficiaries.md b/dbdocs/bcda/public.cclf_beneficiaries.md new file mode 100644 index 000000000..e107b6339 --- /dev/null +++ b/dbdocs/bcda/public.cclf_beneficiaries.md @@ -0,0 +1,43 @@ +# public.cclf_beneficiaries + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | integer | nextval('cclf_beneficiaries_id_seq'::regclass) | false | | | | +| created_at | timestamp with time zone | now() | true | | | | +| updated_at | timestamp with time zone | now() | true | | | | +| file_id | integer | | false | | [public.cclf_files](public.cclf_files.md) | | +| mbi | character(11) | | false | | | | +| beneficiary_id | integer | | true | | | | +| blue_button_id | text | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| cclf_beneficiaries_pkey | PRIMARY KEY | PRIMARY KEY (id) | +| cclf_beneficiaries_file_id_cclf_files_id_foreign | FOREIGN KEY | FOREIGN KEY (file_id) REFERENCES cclf_files(id) ON UPDATE RESTRICT ON DELETE RESTRICT | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| cclf_beneficiaries_pkey | CREATE UNIQUE INDEX cclf_beneficiaries_pkey ON public.cclf_beneficiaries USING btree (id) | +| idx_cclf_beneficiaries_file_id | CREATE INDEX idx_cclf_beneficiaries_file_id ON public.cclf_beneficiaries USING btree (file_id) | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.cclf_beneficiaries FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.cclf_beneficiaries.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.cclf_beneficiaries.svg b/dbdocs/bcda/public.cclf_beneficiaries.svg new file mode 100644 index 000000000..188a512b1 --- /dev/null +++ b/dbdocs/bcda/public.cclf_beneficiaries.svg @@ -0,0 +1,90 @@ + + + + + + +public.cclf_beneficiaries + + + +public.cclf_beneficiaries + + +public.cclf_beneficiaries +     +[BASE TABLE] + +id +[integer] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +file_id +[integer] + +mbi +[character(11)] + +beneficiary_id +[integer] + +blue_button_id +[text] + + + + +public.cclf_files + + +public.cclf_files +     +[BASE TABLE] + +id     +[integer] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +cclf_num     +[integer] + +name     +[text] + +aco_cms_id     +[varchar(8)] + +timestamp     +[timestamp with time zone] + +performance_year     +[integer] + +import_status     +[text] + +type     +[smallint] + + + +public.cclf_beneficiaries:file_id->public.cclf_files:id + + +FOREIGN KEY (file_id) REFERENCES cclf_files(id) ON UPDATE RESTRICT ON DELETE RESTRICT + + + diff --git a/dbdocs/bcda/public.cclf_files.md b/dbdocs/bcda/public.cclf_files.md new file mode 100644 index 000000000..c220247a5 --- /dev/null +++ b/dbdocs/bcda/public.cclf_files.md @@ -0,0 +1,45 @@ +# public.cclf_files + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | integer | nextval('cclf_files_id_seq'::regclass) | false | [public.cclf_beneficiaries](public.cclf_beneficiaries.md) | | | +| created_at | timestamp with time zone | now() | true | | | | +| updated_at | timestamp with time zone | now() | true | | | | +| cclf_num | integer | | false | | | | +| name | text | | false | | | | +| aco_cms_id | varchar(8) | | true | | | | +| timestamp | timestamp with time zone | | false | | | | +| performance_year | integer | | false | | | | +| import_status | text | | true | | | | +| type | smallint | 0 | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| cclf_files_pkey | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| cclf_files_pkey | CREATE UNIQUE INDEX cclf_files_pkey ON public.cclf_files USING btree (id) | +| idx_cclf_files_name_aco_cms_id_key | CREATE UNIQUE INDEX idx_cclf_files_name_aco_cms_id_key ON public.cclf_files USING btree (name, aco_cms_id) | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.cclf_files FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.cclf_files.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.cclf_files.svg b/dbdocs/bcda/public.cclf_files.svg new file mode 100644 index 000000000..6898c225d --- /dev/null +++ b/dbdocs/bcda/public.cclf_files.svg @@ -0,0 +1,90 @@ + + + + + + +public.cclf_files + + + +public.cclf_files + + +public.cclf_files +     +[BASE TABLE] + +id +[integer] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +cclf_num +[integer] + +name +[text] + +aco_cms_id +[varchar(8)] + +timestamp +[timestamp with time zone] + +performance_year +[integer] + +import_status +[text] + +type +[smallint] + + + + +public.cclf_beneficiaries + + +public.cclf_beneficiaries +     +[BASE TABLE] + +id     +[integer] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +file_id     +[integer] + +mbi     +[character(11)] + +beneficiary_id     +[integer] + +blue_button_id     +[text] + + + +public.cclf_beneficiaries:file_id->public.cclf_files:id + + +FOREIGN KEY (file_id) REFERENCES cclf_files(id) ON UPDATE RESTRICT ON DELETE RESTRICT + + + diff --git a/dbdocs/bcda/public.job_keys.md b/dbdocs/bcda/public.job_keys.md new file mode 100644 index 000000000..98fc5a23d --- /dev/null +++ b/dbdocs/bcda/public.job_keys.md @@ -0,0 +1,42 @@ +# public.job_keys + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | integer | nextval('job_keys_id_seq'::regclass) | false | | | | +| created_at | timestamp with time zone | now() | true | | | | +| updated_at | timestamp with time zone | now() | true | | | | +| job_id | integer | nextval('job_keys_job_id_seq'::regclass) | false | | | | +| file_name | character(127) | | true | | | | +| resource_type | text | | true | | | | +| que_job_id | bigint | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| job_keys_pkey | PRIMARY KEY | PRIMARY KEY (id, job_id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| job_keys_pkey | CREATE UNIQUE INDEX job_keys_pkey ON public.job_keys USING btree (id, job_id) | +| idx_job_keys_job_id_que_job_id | CREATE INDEX idx_job_keys_job_id_que_job_id ON public.job_keys USING btree (job_id, que_job_id) | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.job_keys FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.job_keys.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.job_keys.svg b/dbdocs/bcda/public.job_keys.svg new file mode 100644 index 000000000..b32220269 --- /dev/null +++ b/dbdocs/bcda/public.job_keys.svg @@ -0,0 +1,44 @@ + + + + + + +public.job_keys + + + +public.job_keys + + +public.job_keys +     +[BASE TABLE] + +id +[integer] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +job_id +[integer] + +file_name +[character(127)] + +resource_type +[text] + +que_job_id +[bigint] + + + + diff --git a/dbdocs/bcda/public.jobs.md b/dbdocs/bcda/public.jobs.md new file mode 100644 index 000000000..21bd46da5 --- /dev/null +++ b/dbdocs/bcda/public.jobs.md @@ -0,0 +1,38 @@ +# public.jobs + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | integer | nextval('jobs_id_seq'::regclass) | false | | | | +| aco_id | uuid | | false | | [public.acos](public.acos.md) | | +| request_url | text | | false | | | | +| status | text | | false | | | | +| created_at | timestamp with time zone | now() | false | | | | +| updated_at | timestamp with time zone | | true | | | | +| job_count | integer | | true | | | | +| transaction_time | timestamp with time zone | | true | | | | +| priority | integer | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| jobs_aco_id_fkey | FOREIGN KEY | FOREIGN KEY (aco_id) REFERENCES acos(uuid) | +| jobs_pkey | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| jobs_pkey | CREATE UNIQUE INDEX jobs_pkey ON public.jobs USING btree (id) | + +## Relations + +![er](public.jobs.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.jobs.svg b/dbdocs/bcda/public.jobs.svg new file mode 100644 index 000000000..90e92b5e7 --- /dev/null +++ b/dbdocs/bcda/public.jobs.svg @@ -0,0 +1,96 @@ + + + + + + +public.jobs + + + +public.jobs + + +public.jobs +     +[BASE TABLE] + +id +[integer] + +aco_id +[uuid] + +request_url +[text] + +status +[text] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +job_count +[integer] + +transaction_time +[timestamp with time zone] + +priority +[integer] + + + + +public.acos + + +public.acos +     +[BASE TABLE] + +uuid     +[uuid] + +name     +[text] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +id     +[integer] + +client_id     +[text] + +cms_id     +[varchar(8)] + +group_id     +[text] + +system_id     +[text] + +termination_details     +[jsonb] + + + +public.jobs:aco_id->public.acos:uuid + + +FOREIGN KEY (aco_id) REFERENCES acos(uuid) + + + diff --git a/dbdocs/bcda/public.schema_migrations_bcda.md b/dbdocs/bcda/public.schema_migrations_bcda.md new file mode 100644 index 000000000..1d4a1b653 --- /dev/null +++ b/dbdocs/bcda/public.schema_migrations_bcda.md @@ -0,0 +1,30 @@ +# public.schema_migrations_bcda + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| version | bigint | | false | | | | +| dirty | boolean | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| schema_migrations_bcda_pkey | PRIMARY KEY | PRIMARY KEY (version) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| schema_migrations_bcda_pkey | CREATE UNIQUE INDEX schema_migrations_bcda_pkey ON public.schema_migrations_bcda USING btree (version) | + +## Relations + +![er](public.schema_migrations_bcda.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.schema_migrations_bcda.svg b/dbdocs/bcda/public.schema_migrations_bcda.svg new file mode 100644 index 000000000..5d29637b6 --- /dev/null +++ b/dbdocs/bcda/public.schema_migrations_bcda.svg @@ -0,0 +1,29 @@ + + + + + + +public.schema_migrations_bcda + + + +public.schema_migrations_bcda + + +public.schema_migrations_bcda +     +[BASE TABLE] + +version +[bigint] + +dirty +[boolean] + + + + diff --git a/dbdocs/bcda/public.suppression_files.md b/dbdocs/bcda/public.suppression_files.md new file mode 100644 index 000000000..f770ee7f3 --- /dev/null +++ b/dbdocs/bcda/public.suppression_files.md @@ -0,0 +1,42 @@ +# public.suppression_files + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | integer | nextval('suppression_files_id_seq'::regclass) | false | | | | +| created_at | timestamp with time zone | now() | true | | | | +| updated_at | timestamp with time zone | now() | true | | | | +| name | text | | false | | | | +| timestamp | timestamp with time zone | | false | | | | +| import_status | text | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| suppression_files_name_key | UNIQUE | UNIQUE (name) | +| suppression_files_pkey | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| suppression_files_name_key | CREATE UNIQUE INDEX suppression_files_name_key ON public.suppression_files USING btree (name) | +| suppression_files_pkey | CREATE UNIQUE INDEX suppression_files_pkey ON public.suppression_files USING btree (id) | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.suppression_files FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.suppression_files.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.suppression_files.svg b/dbdocs/bcda/public.suppression_files.svg new file mode 100644 index 000000000..57bd2a468 --- /dev/null +++ b/dbdocs/bcda/public.suppression_files.svg @@ -0,0 +1,41 @@ + + + + + + +public.suppression_files + + + +public.suppression_files + + +public.suppression_files +     +[BASE TABLE] + +id +[integer] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +name +[text] + +timestamp +[timestamp with time zone] + +import_status +[text] + + + + diff --git a/dbdocs/bcda/public.suppressions.md b/dbdocs/bcda/public.suppressions.md new file mode 100644 index 000000000..e8aa387a4 --- /dev/null +++ b/dbdocs/bcda/public.suppressions.md @@ -0,0 +1,54 @@ +# public.suppressions + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| id | integer | nextval('suppressions_id_seq'::regclass) | false | | | | +| created_at | timestamp with time zone | now() | true | | | | +| updated_at | timestamp with time zone | now() | true | | | | +| source_code | varchar(5) | | true | | | | +| effective_dt | timestamp with time zone | | true | | | | +| pref_indicator | character(1) | | true | | | | +| samhsa_source_code | varchar(5) | | true | | | | +| samhsa_effective_dt | timestamp with time zone | | true | | | | +| samhsa_pref_indicator | character(1) | | true | | | | +| aco_cms_id | varchar(8) | | true | | | | +| beneficiary_link_key | integer | | true | | | | +| effective_date | timestamp with time zone | | true | | | | +| preference_indicator | character(1) | | true | | | | +| samhsa_effective_date | timestamp with time zone | | true | | | | +| samhsa_preference_indicator | character(1) | | true | | | | +| file_id | integer | | false | | | | +| blue_button_id | text | | true | | | | +| mbi | varchar(11) | | true | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| suppressions_pkey | PRIMARY KEY | PRIMARY KEY (id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| suppressions_pkey | CREATE UNIQUE INDEX suppressions_pkey ON public.suppressions USING btree (id) | +| idx_suppression_bb_id | CREATE INDEX idx_suppression_bb_id ON public.suppressions USING btree (blue_button_id) | +| idx_suppression_mbi | CREATE INDEX idx_suppression_mbi ON public.suppressions USING btree (mbi) | + +## Triggers + +| Name | Definition | +| ---- | ---------- | +| set_timestamp | CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.suppressions FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp() | + +## Relations + +![er](public.suppressions.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda/public.suppressions.svg b/dbdocs/bcda/public.suppressions.svg new file mode 100644 index 000000000..bc24f4861 --- /dev/null +++ b/dbdocs/bcda/public.suppressions.svg @@ -0,0 +1,77 @@ + + + + + + +public.suppressions + + + +public.suppressions + + +public.suppressions +     +[BASE TABLE] + +id +[integer] + +created_at +[timestamp with time zone] + +updated_at +[timestamp with time zone] + +source_code +[varchar(5)] + +effective_dt +[timestamp with time zone] + +pref_indicator +[character(1)] + +samhsa_source_code +[varchar(5)] + +samhsa_effective_dt +[timestamp with time zone] + +samhsa_pref_indicator +[character(1)] + +aco_cms_id +[varchar(8)] + +beneficiary_link_key +[integer] + +effective_date +[timestamp with time zone] + +preference_indicator +[character(1)] + +samhsa_effective_date +[timestamp with time zone] + +samhsa_preference_indicator +[character(1)] + +file_id +[integer] + +blue_button_id +[text] + +mbi +[varchar(11)] + + + + diff --git a/dbdocs/bcda/schema.json b/dbdocs/bcda/schema.json new file mode 100644 index 000000000..379f59d03 --- /dev/null +++ b/dbdocs/bcda/schema.json @@ -0,0 +1 @@ +{"name":"bcda","desc":"","tables":[{"name":"public.schema_migrations_bcda","type":"BASE TABLE","comment":"","columns":[{"name":"version","type":"bigint","nullable":false,"default":null,"comment":""},{"name":"dirty","type":"boolean","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"schema_migrations_bcda_pkey","def":"CREATE UNIQUE INDEX schema_migrations_bcda_pkey ON public.schema_migrations_bcda USING btree (version)","table":"public.schema_migrations_bcda","columns":["version"],"comment":""}],"constraints":[{"name":"schema_migrations_bcda_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (version)","table":"public.schema_migrations_bcda","referenced_table":"","columns":["version"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""},{"name":"public.acos","type":"BASE TABLE","comment":"","columns":[{"name":"uuid","type":"uuid","nullable":false,"default":null,"comment":""},{"name":"name","type":"text","nullable":false,"default":null,"comment":""},{"name":"created_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"id","type":"integer","nullable":false,"default":"nextval('acos_id_seq'::regclass)","comment":""},{"name":"client_id","type":"text","nullable":true,"default":null,"comment":""},{"name":"cms_id","type":"varchar(8)","nullable":true,"default":null,"comment":""},{"name":"group_id","type":"text","nullable":true,"default":null,"comment":""},{"name":"system_id","type":"text","nullable":true,"default":null,"comment":""},{"name":"termination_details","type":"jsonb","nullable":true,"default":null,"comment":""}],"indexes":[{"name":"acos_pkey","def":"CREATE UNIQUE INDEX acos_pkey ON public.acos USING btree (uuid)","table":"public.acos","columns":["uuid"],"comment":""},{"name":"acos_cms_id_key","def":"CREATE UNIQUE INDEX acos_cms_id_key ON public.acos USING btree (cms_id)","table":"public.acos","columns":["cms_id"],"comment":""}],"constraints":[{"name":"acos_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (uuid)","table":"public.acos","referenced_table":"","columns":["uuid"],"referenced_columns":[],"comment":""},{"name":"acos_cms_id_key","type":"UNIQUE","def":"UNIQUE (cms_id)","table":"public.acos","referenced_table":"","columns":["cms_id"],"referenced_columns":[],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.acos FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""},{"name":"public.cclf_beneficiaries","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('cclf_beneficiaries_id_seq'::regclass)","comment":""},{"name":"created_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"file_id","type":"integer","nullable":false,"default":null,"comment":""},{"name":"mbi","type":"character(11)","nullable":false,"default":null,"comment":""},{"name":"beneficiary_id","type":"integer","nullable":true,"default":null,"comment":""},{"name":"blue_button_id","type":"text","nullable":true,"default":null,"comment":""}],"indexes":[{"name":"cclf_beneficiaries_pkey","def":"CREATE UNIQUE INDEX cclf_beneficiaries_pkey ON public.cclf_beneficiaries USING btree (id)","table":"public.cclf_beneficiaries","columns":["id"],"comment":""},{"name":"idx_cclf_beneficiaries_file_id","def":"CREATE INDEX idx_cclf_beneficiaries_file_id ON public.cclf_beneficiaries USING btree (file_id)","table":"public.cclf_beneficiaries","columns":["file_id"],"comment":""}],"constraints":[{"name":"cclf_beneficiaries_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"public.cclf_beneficiaries","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""},{"name":"cclf_beneficiaries_file_id_cclf_files_id_foreign","type":"FOREIGN KEY","def":"FOREIGN KEY (file_id) REFERENCES cclf_files(id) ON UPDATE RESTRICT ON DELETE RESTRICT","table":"public.cclf_beneficiaries","referenced_table":"cclf_files","columns":["file_id"],"referenced_columns":["id"],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.cclf_beneficiaries FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""},{"name":"public.cclf_files","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('cclf_files_id_seq'::regclass)","comment":""},{"name":"created_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"cclf_num","type":"integer","nullable":false,"default":null,"comment":""},{"name":"name","type":"text","nullable":false,"default":null,"comment":""},{"name":"aco_cms_id","type":"varchar(8)","nullable":true,"default":null,"comment":""},{"name":"timestamp","type":"timestamp with time zone","nullable":false,"default":null,"comment":""},{"name":"performance_year","type":"integer","nullable":false,"default":null,"comment":""},{"name":"import_status","type":"text","nullable":true,"default":null,"comment":""},{"name":"type","type":"smallint","nullable":true,"default":"0","comment":""}],"indexes":[{"name":"cclf_files_pkey","def":"CREATE UNIQUE INDEX cclf_files_pkey ON public.cclf_files USING btree (id)","table":"public.cclf_files","columns":["id"],"comment":""},{"name":"idx_cclf_files_name_aco_cms_id_key","def":"CREATE UNIQUE INDEX idx_cclf_files_name_aco_cms_id_key ON public.cclf_files USING btree (name, aco_cms_id)","table":"public.cclf_files","columns":["aco_cms_id","name"],"comment":""}],"constraints":[{"name":"cclf_files_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"public.cclf_files","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.cclf_files FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""},{"name":"public.job_keys","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('job_keys_id_seq'::regclass)","comment":""},{"name":"created_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"job_id","type":"integer","nullable":false,"default":"nextval('job_keys_job_id_seq'::regclass)","comment":""},{"name":"file_name","type":"character(127)","nullable":true,"default":null,"comment":""},{"name":"resource_type","type":"text","nullable":true,"default":null,"comment":""},{"name":"que_job_id","type":"bigint","nullable":true,"default":null,"comment":""}],"indexes":[{"name":"job_keys_pkey","def":"CREATE UNIQUE INDEX job_keys_pkey ON public.job_keys USING btree (id, job_id)","table":"public.job_keys","columns":["id","job_id"],"comment":""},{"name":"idx_job_keys_job_id_que_job_id","def":"CREATE INDEX idx_job_keys_job_id_que_job_id ON public.job_keys USING btree (job_id, que_job_id)","table":"public.job_keys","columns":["job_id","que_job_id"],"comment":""}],"constraints":[{"name":"job_keys_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id, job_id)","table":"public.job_keys","referenced_table":"","columns":["id","job_id"],"referenced_columns":[],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.job_keys FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""},{"name":"public.jobs","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('jobs_id_seq'::regclass)","comment":""},{"name":"aco_id","type":"uuid","nullable":false,"default":null,"comment":""},{"name":"request_url","type":"text","nullable":false,"default":null,"comment":""},{"name":"status","type":"text","nullable":false,"default":null,"comment":""},{"name":"created_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":true,"default":null,"comment":""},{"name":"job_count","type":"integer","nullable":true,"default":null,"comment":""},{"name":"transaction_time","type":"timestamp with time zone","nullable":true,"default":null,"comment":""},{"name":"priority","type":"integer","nullable":true,"default":null,"comment":""}],"indexes":[{"name":"jobs_pkey","def":"CREATE UNIQUE INDEX jobs_pkey ON public.jobs USING btree (id)","table":"public.jobs","columns":["id"],"comment":""}],"constraints":[{"name":"jobs_aco_id_fkey","type":"FOREIGN KEY","def":"FOREIGN KEY (aco_id) REFERENCES acos(uuid)","table":"public.jobs","referenced_table":"acos","columns":["aco_id"],"referenced_columns":["uuid"],"comment":""},{"name":"jobs_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"public.jobs","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""},{"name":"public.suppression_files","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('suppression_files_id_seq'::regclass)","comment":""},{"name":"created_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"name","type":"text","nullable":false,"default":null,"comment":""},{"name":"timestamp","type":"timestamp with time zone","nullable":false,"default":null,"comment":""},{"name":"import_status","type":"text","nullable":true,"default":null,"comment":""}],"indexes":[{"name":"suppression_files_name_key","def":"CREATE UNIQUE INDEX suppression_files_name_key ON public.suppression_files USING btree (name)","table":"public.suppression_files","columns":["name"],"comment":""},{"name":"suppression_files_pkey","def":"CREATE UNIQUE INDEX suppression_files_pkey ON public.suppression_files USING btree (id)","table":"public.suppression_files","columns":["id"],"comment":""}],"constraints":[{"name":"suppression_files_name_key","type":"UNIQUE","def":"UNIQUE (name)","table":"public.suppression_files","referenced_table":"","columns":["name"],"referenced_columns":[],"comment":""},{"name":"suppression_files_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"public.suppression_files","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.suppression_files FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""},{"name":"public.suppressions","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('suppressions_id_seq'::regclass)","comment":""},{"name":"created_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":true,"default":"now()","comment":""},{"name":"source_code","type":"varchar(5)","nullable":true,"default":null,"comment":""},{"name":"effective_dt","type":"timestamp with time zone","nullable":true,"default":null,"comment":""},{"name":"pref_indicator","type":"character(1)","nullable":true,"default":null,"comment":""},{"name":"samhsa_source_code","type":"varchar(5)","nullable":true,"default":null,"comment":""},{"name":"samhsa_effective_dt","type":"timestamp with time zone","nullable":true,"default":null,"comment":""},{"name":"samhsa_pref_indicator","type":"character(1)","nullable":true,"default":null,"comment":""},{"name":"aco_cms_id","type":"varchar(8)","nullable":true,"default":null,"comment":""},{"name":"beneficiary_link_key","type":"integer","nullable":true,"default":null,"comment":""},{"name":"effective_date","type":"timestamp with time zone","nullable":true,"default":null,"comment":""},{"name":"preference_indicator","type":"character(1)","nullable":true,"default":null,"comment":""},{"name":"samhsa_effective_date","type":"timestamp with time zone","nullable":true,"default":null,"comment":""},{"name":"samhsa_preference_indicator","type":"character(1)","nullable":true,"default":null,"comment":""},{"name":"file_id","type":"integer","nullable":false,"default":null,"comment":""},{"name":"blue_button_id","type":"text","nullable":true,"default":null,"comment":""},{"name":"mbi","type":"varchar(11)","nullable":true,"default":null,"comment":""}],"indexes":[{"name":"suppressions_pkey","def":"CREATE UNIQUE INDEX suppressions_pkey ON public.suppressions USING btree (id)","table":"public.suppressions","columns":["id"],"comment":""},{"name":"idx_suppression_bb_id","def":"CREATE INDEX idx_suppression_bb_id ON public.suppressions USING btree (blue_button_id)","table":"public.suppressions","columns":["blue_button_id"],"comment":""},{"name":"idx_suppression_mbi","def":"CREATE INDEX idx_suppression_mbi ON public.suppressions USING btree (mbi)","table":"public.suppressions","columns":["mbi"],"comment":""}],"constraints":[{"name":"suppressions_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"public.suppressions","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.suppressions FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""},{"name":"public.alr","type":"BASE TABLE","comment":"","columns":[{"name":"created_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"id","type":"bigint","nullable":false,"default":"nextval('alr_id_seq'::regclass)","comment":""},{"name":"metakey","type":"bigint","nullable":false,"default":null,"comment":""},{"name":"mbi","type":"character(11)","nullable":false,"default":null,"comment":""},{"name":"hic","type":"character(12)","nullable":true,"default":null,"comment":""},{"name":"firstname","type":"varchar(30)","nullable":true,"default":null,"comment":""},{"name":"lastname","type":"varchar(40)","nullable":true,"default":null,"comment":""},{"name":"sex","type":"character(1)","nullable":true,"default":null,"comment":""},{"name":"dob","type":"timestamp without time zone","nullable":true,"default":null,"comment":""},{"name":"dod","type":"timestamp without time zone","nullable":true,"default":null,"comment":""},{"name":"keyvalue","type":"bytea","nullable":true,"default":null,"comment":""}],"indexes":[],"constraints":[{"name":"foreign_key_alr","type":"FOREIGN KEY","def":"FOREIGN KEY (metakey) REFERENCES alr_meta(id) ON UPDATE RESTRICT ON DELETE RESTRICT","table":"public.alr","referenced_table":"alr_meta","columns":["metakey"],"referenced_columns":["id"],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.alr FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""},{"name":"public.alr_meta","type":"BASE TABLE","comment":"","columns":[{"name":"created_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"updated_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"id","type":"bigint","nullable":false,"default":"nextval('alr_meta_id_seq'::regclass)","comment":""},{"name":"aco","type":"varchar(5)","nullable":true,"default":null,"comment":""},{"name":"timestp","type":"timestamp with time zone","nullable":true,"default":null,"comment":""}],"indexes":[{"name":"alr_meta_id_aco_timestp_key","def":"CREATE UNIQUE INDEX alr_meta_id_aco_timestp_key ON public.alr_meta USING btree (id, aco, timestp)","table":"public.alr_meta","columns":["aco","id","timestp"],"comment":""},{"name":"idx_metaid_timestamp","def":"CREATE INDEX idx_metaid_timestamp ON public.alr_meta USING btree (aco, timestp)","table":"public.alr_meta","columns":["aco","timestp"],"comment":""},{"name":"primary_key_alr_meta","def":"CREATE UNIQUE INDEX primary_key_alr_meta ON public.alr_meta USING btree (id)","table":"public.alr_meta","columns":["id"],"comment":""}],"constraints":[{"name":"alr_meta_id_aco_timestp_key","type":"UNIQUE","def":"UNIQUE (id, aco, timestp)","table":"public.alr_meta","referenced_table":"","columns":["id","aco","timestp"],"referenced_columns":[],"comment":""},{"name":"primary_key_alr_meta","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"public.alr_meta","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[{"name":"set_timestamp","def":"CREATE TRIGGER set_timestamp BEFORE UPDATE ON public.alr_meta FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamp()","comment":""}],"def":""}],"relations":[{"table":"public.cclf_beneficiaries","columns":["file_id"],"cardinality":"Zero or more","parent_table":"public.cclf_files","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (file_id) REFERENCES cclf_files(id) ON UPDATE RESTRICT ON DELETE RESTRICT","virtual":false},{"table":"public.jobs","columns":["aco_id"],"cardinality":"Zero or more","parent_table":"public.acos","parent_columns":["uuid"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (aco_id) REFERENCES acos(uuid)","virtual":false},{"table":"public.alr","columns":["metakey"],"cardinality":"Zero or more","parent_table":"public.alr_meta","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (metakey) REFERENCES alr_meta(id) ON UPDATE RESTRICT ON DELETE RESTRICT","virtual":false}],"functions":[{"name":"public.trigger_set_timestamp","return_type":"trigger","arguments":"","type":"FUNCTION"}],"driver":{"name":"postgres","database_version":"PostgreSQL 15.8 (Debian 15.8-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit","meta":{"current_schema":"public","search_paths":["postgres","public"],"dict":{"Functions":"Stored procedures and functions"}}}} diff --git a/dbdocs/bcda/schema.svg b/dbdocs/bcda/schema.svg new file mode 100644 index 000000000..a282e5221 --- /dev/null +++ b/dbdocs/bcda/schema.svg @@ -0,0 +1,382 @@ + + + + + + +bcda + + + +public.schema_migrations_bcda + + +public.schema_migrations_bcda +     +[BASE TABLE] + +version     +[bigint] + +dirty     +[boolean] + + + +public.acos + + +public.acos +     +[BASE TABLE] + +uuid     +[uuid] + +name     +[text] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +id     +[integer] + +client_id     +[text] + +cms_id     +[varchar(8)] + +group_id     +[text] + +system_id     +[text] + +termination_details     +[jsonb] + + + +public.cclf_beneficiaries + + +public.cclf_beneficiaries +     +[BASE TABLE] + +id     +[integer] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +file_id     +[integer] + +mbi     +[character(11)] + +beneficiary_id     +[integer] + +blue_button_id     +[text] + + + +public.cclf_files + + +public.cclf_files +     +[BASE TABLE] + +id     +[integer] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +cclf_num     +[integer] + +name     +[text] + +aco_cms_id     +[varchar(8)] + +timestamp     +[timestamp with time zone] + +performance_year     +[integer] + +import_status     +[text] + +type     +[smallint] + + + +public.cclf_beneficiaries:file_id->public.cclf_files:id + + +FOREIGN KEY (file_id) REFERENCES cclf_files(id) ON UPDATE RESTRICT ON DELETE RESTRICT + + + +public.job_keys + + +public.job_keys +     +[BASE TABLE] + +id     +[integer] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +job_id     +[integer] + +file_name     +[character(127)] + +resource_type     +[text] + +que_job_id     +[bigint] + + + +public.jobs + + +public.jobs +     +[BASE TABLE] + +id     +[integer] + +aco_id     +[uuid] + +request_url     +[text] + +status     +[text] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +job_count     +[integer] + +transaction_time     +[timestamp with time zone] + +priority     +[integer] + + + +public.jobs:aco_id->public.acos:uuid + + +FOREIGN KEY (aco_id) REFERENCES acos(uuid) + + + +public.suppression_files + + +public.suppression_files +     +[BASE TABLE] + +id     +[integer] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +name     +[text] + +timestamp     +[timestamp with time zone] + +import_status     +[text] + + + +public.suppressions + + +public.suppressions +     +[BASE TABLE] + +id     +[integer] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +source_code     +[varchar(5)] + +effective_dt     +[timestamp with time zone] + +pref_indicator     +[character(1)] + +samhsa_source_code     +[varchar(5)] + +samhsa_effective_dt     +[timestamp with time zone] + +samhsa_pref_indicator     +[character(1)] + +aco_cms_id     +[varchar(8)] + +beneficiary_link_key     +[integer] + +effective_date     +[timestamp with time zone] + +preference_indicator     +[character(1)] + +samhsa_effective_date     +[timestamp with time zone] + +samhsa_preference_indicator     +[character(1)] + +file_id     +[integer] + +blue_button_id     +[text] + +mbi     +[varchar(11)] + + + +public.alr + + +public.alr +     +[BASE TABLE] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +id     +[bigint] + +metakey     +[bigint] + +mbi     +[character(11)] + +hic     +[character(12)] + +firstname     +[varchar(30)] + +lastname     +[varchar(40)] + +sex     +[character(1)] + +dob     +[timestamp without time zone] + +dod     +[timestamp without time zone] + +keyvalue     +[bytea] + + + +public.alr_meta + + +public.alr_meta +     +[BASE TABLE] + +created_at     +[timestamp with time zone] + +updated_at     +[timestamp with time zone] + +id     +[bigint] + +aco     +[varchar(5)] + +timestp     +[timestamp with time zone] + + + +public.alr:metakey->public.alr_meta:id + + +FOREIGN KEY (metakey) REFERENCES alr_meta(id) ON UPDATE RESTRICT ON DELETE RESTRICT + + + diff --git a/dbdocs/bcda_queue/README.md b/dbdocs/bcda_queue/README.md new file mode 100644 index 000000000..a026a04ee --- /dev/null +++ b/dbdocs/bcda_queue/README.md @@ -0,0 +1,16 @@ +# bcda_queue + +## Tables + +| Name | Columns | Comment | Type | +| ---- | ------- | ------- | ---- | +| [public.schema_migrations_bcda_queue](public.schema_migrations_bcda_queue.md) | 2 | | BASE TABLE | +| [public.que_jobs](public.que_jobs.md) | 8 | 3 | BASE TABLE | + +## Relations + +![er](schema.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda_queue/public.que_jobs.md b/dbdocs/bcda_queue/public.que_jobs.md new file mode 100644 index 000000000..da5c84ec5 --- /dev/null +++ b/dbdocs/bcda_queue/public.que_jobs.md @@ -0,0 +1,38 @@ +# public.que_jobs + +## Description + +3 + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| priority | smallint | 100 | false | | | | +| run_at | timestamp with time zone | now() | false | | | | +| job_id | bigint | nextval('que_jobs_job_id_seq'::regclass) | false | | | | +| job_class | text | | false | | | | +| args | json | '[]'::json | false | | | | +| error_count | integer | 0 | false | | | | +| last_error | text | | true | | | | +| queue | text | ''::text | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| que_jobs_pkey | PRIMARY KEY | PRIMARY KEY (queue, priority, run_at, job_id) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| que_jobs_pkey | CREATE UNIQUE INDEX que_jobs_pkey ON public.que_jobs USING btree (queue, priority, run_at, job_id) | + +## Relations + +![er](public.que_jobs.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda_queue/public.que_jobs.svg b/dbdocs/bcda_queue/public.que_jobs.svg new file mode 100644 index 000000000..cf629f3b0 --- /dev/null +++ b/dbdocs/bcda_queue/public.que_jobs.svg @@ -0,0 +1,47 @@ + + + + + + +public.que_jobs + + + +public.que_jobs + + +public.que_jobs +     +[BASE TABLE] + +priority +[smallint] + +run_at +[timestamp with time zone] + +job_id +[bigint] + +job_class +[text] + +args +[json] + +error_count +[integer] + +last_error +[text] + +queue +[text] + + + + diff --git a/dbdocs/bcda_queue/public.schema_migrations_bcda_queue.md b/dbdocs/bcda_queue/public.schema_migrations_bcda_queue.md new file mode 100644 index 000000000..4a5a6ca23 --- /dev/null +++ b/dbdocs/bcda_queue/public.schema_migrations_bcda_queue.md @@ -0,0 +1,30 @@ +# public.schema_migrations_bcda_queue + +## Description + +## Columns + +| Name | Type | Default | Nullable | Children | Parents | Comment | +| ---- | ---- | ------- | -------- | -------- | ------- | ------- | +| version | bigint | | false | | | | +| dirty | boolean | | false | | | | + +## Constraints + +| Name | Type | Definition | +| ---- | ---- | ---------- | +| schema_migrations_bcda_queue_pkey | PRIMARY KEY | PRIMARY KEY (version) | + +## Indexes + +| Name | Definition | +| ---- | ---------- | +| schema_migrations_bcda_queue_pkey | CREATE UNIQUE INDEX schema_migrations_bcda_queue_pkey ON public.schema_migrations_bcda_queue USING btree (version) | + +## Relations + +![er](public.schema_migrations_bcda_queue.svg) + +--- + +> Generated by [tbls](https://github.com/k1LoW/tbls) diff --git a/dbdocs/bcda_queue/public.schema_migrations_bcda_queue.svg b/dbdocs/bcda_queue/public.schema_migrations_bcda_queue.svg new file mode 100644 index 000000000..e3113a260 --- /dev/null +++ b/dbdocs/bcda_queue/public.schema_migrations_bcda_queue.svg @@ -0,0 +1,29 @@ + + + + + + +public.schema_migrations_bcda_queue + + + +public.schema_migrations_bcda_queue + + +public.schema_migrations_bcda_queue +     +[BASE TABLE] + +version +[bigint] + +dirty +[boolean] + + + + diff --git a/dbdocs/bcda_queue/schema.json b/dbdocs/bcda_queue/schema.json new file mode 100644 index 000000000..219e3b204 --- /dev/null +++ b/dbdocs/bcda_queue/schema.json @@ -0,0 +1 @@ +{"name":"bcda_queue","desc":"","tables":[{"name":"public.schema_migrations_bcda_queue","type":"BASE TABLE","comment":"","columns":[{"name":"version","type":"bigint","nullable":false,"default":null,"comment":""},{"name":"dirty","type":"boolean","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"schema_migrations_bcda_queue_pkey","def":"CREATE UNIQUE INDEX schema_migrations_bcda_queue_pkey ON public.schema_migrations_bcda_queue USING btree (version)","table":"public.schema_migrations_bcda_queue","columns":["version"],"comment":""}],"constraints":[{"name":"schema_migrations_bcda_queue_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (version)","table":"public.schema_migrations_bcda_queue","referenced_table":"","columns":["version"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""},{"name":"public.que_jobs","type":"BASE TABLE","comment":"3","columns":[{"name":"priority","type":"smallint","nullable":false,"default":"100","comment":""},{"name":"run_at","type":"timestamp with time zone","nullable":false,"default":"now()","comment":""},{"name":"job_id","type":"bigint","nullable":false,"default":"nextval('que_jobs_job_id_seq'::regclass)","comment":""},{"name":"job_class","type":"text","nullable":false,"default":null,"comment":""},{"name":"args","type":"json","nullable":false,"default":"'[]'::json","comment":""},{"name":"error_count","type":"integer","nullable":false,"default":"0","comment":""},{"name":"last_error","type":"text","nullable":true,"default":null,"comment":""},{"name":"queue","type":"text","nullable":false,"default":"''::text","comment":""}],"indexes":[{"name":"que_jobs_pkey","def":"CREATE UNIQUE INDEX que_jobs_pkey ON public.que_jobs USING btree (queue, priority, run_at, job_id)","table":"public.que_jobs","columns":["job_id","priority","queue","run_at"],"comment":""}],"constraints":[{"name":"que_jobs_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (queue, priority, run_at, job_id)","table":"public.que_jobs","referenced_table":"","columns":["priority","run_at","job_id","queue"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""}],"relations":[],"functions":[],"driver":{"name":"postgres","database_version":"PostgreSQL 15.8 (Debian 15.8-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit","meta":{"current_schema":"public","search_paths":["postgres","public"],"dict":{"Functions":"Stored procedures and functions"}}}} diff --git a/dbdocs/bcda_queue/schema.svg b/dbdocs/bcda_queue/schema.svg new file mode 100644 index 000000000..7414ccb17 --- /dev/null +++ b/dbdocs/bcda_queue/schema.svg @@ -0,0 +1,61 @@ + + + + + + +bcda_queue + + + +public.schema_migrations_bcda_queue + + +public.schema_migrations_bcda_queue +     +[BASE TABLE] + +version     +[bigint] + +dirty     +[boolean] + + + +public.que_jobs + + +public.que_jobs +     +[BASE TABLE] + +priority     +[smallint] + +run_at     +[timestamp with time zone] + +job_id     +[bigint] + +job_class     +[text] + +args     +[json] + +error_count     +[integer] + +last_error     +[text] + +queue     +[text] + + +