Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/dot-github/workflo…
Browse files Browse the repository at this point in the history
…ws/github_actions-393ff94d45
  • Loading branch information
bhagatparwinder authored Oct 1, 2024
2 parents 4d9c5ba + 3f6f9ac commit 5f3c176
Show file tree
Hide file tree
Showing 29 changed files with 1,462 additions and 23 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/dbdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This workflow generates database documentation and ERD files.
#
name: Generate dbdocs

on:
pull_request:
paths:
- .github/workflows/dbdocs.yml
- db/migrations

jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- 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
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ postman:
migrations-test:
docker compose -f docker-compose.test.yml run --rm tests bash ops/migrations_test.sh

unit-test:
start-db:
docker compose up -d db

unit-test: start-db
docker compose -f docker-compose.test.yml run --rm tests bash unit_test.sh

test:
Expand All @@ -54,4 +56,7 @@ docker-bootstrap:
sleep 40
$(MAKE) load-fixtures

.PHONY: docker-build docker-bootstrap load-fixtures test package release smoke-test postman unit-test lint migrations-test
dbdocs: start-db load-fixtures
docker run --rm -v $PWD:/work -w /work --network bcda-ssas-app_default ghcr.io/k1low/tbls doc --rm-dist "postgres://postgres:toor@db:5432/bcda?sslmode=disable" dbdocs/bcda

.PHONY: docker-build docker-bootstrap load-fixtures test package release smoke-test postman unit-test lint migrations-test start-db dbdocs
23 changes: 23 additions & 0 deletions dbdocs/bcda/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# bcda

## Tables

| Name | Columns | Comment | Type |
| ---- | ------- | ------- | ---- |
| [public.schema_migrations](public.schema_migrations.md) | 2 | | BASE TABLE |
| [public.blacklist_entries](public.blacklist_entries.md) | 7 | | BASE TABLE |
| [public.encryption_keys](public.encryption_keys.md) | 7 | | BASE TABLE |
| [public.groups](public.groups.md) | 7 | | BASE TABLE |
| [public.secrets](public.secrets.md) | 6 | | BASE TABLE |
| [public.systems](public.systems.md) | 12 | | BASE TABLE |
| [public.ips](public.ips.md) | 6 | | BASE TABLE |
| [public.client_tokens](public.client_tokens.md) | 8 | | BASE TABLE |
| [public.root_keys](public.root_keys.md) | 8 | | BASE TABLE |

## Relations

![er](schema.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
36 changes: 36 additions & 0 deletions dbdocs/bcda/public.blacklist_entries.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# public.blacklist_entries

## Description

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | integer | nextval('blacklist_entries_id_seq'::regclass) | false | | | |
| created_at | timestamp with time zone | | true | | | |
| updated_at | timestamp with time zone | | true | | | |
| deleted_at | timestamp with time zone | | true | | | |
| key | text | | false | | | |
| entry_date | bigint | | false | | | |
| cache_expiration | bigint | | false | | | |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| blacklist_entries_pkey | PRIMARY KEY | PRIMARY KEY (id) |

## Indexes

| Name | Definition |
| ---- | ---------- |
| blacklist_entries_pkey | CREATE UNIQUE INDEX blacklist_entries_pkey ON public.blacklist_entries USING btree (id) |
| idx_blacklist_entries_deleted_at | CREATE INDEX idx_blacklist_entries_deleted_at ON public.blacklist_entries USING btree (deleted_at) |

## Relations

![er](public.blacklist_entries.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
44 changes: 44 additions & 0 deletions dbdocs/bcda/public.blacklist_entries.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions dbdocs/bcda/public.client_tokens.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# public.client_tokens

## Description

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | integer | nextval('client_tokens_id_seq'::regclass) | false | | | |
| created_at | timestamp with time zone | | true | | | |
| updated_at | timestamp with time zone | | true | | | |
| deleted_at | timestamp with time zone | | true | | | |
| label | text | | true | | | |
| uuid | text | | false | | | |
| system_id | integer | | true | | | |
| expires_at | timestamp with time zone | | true | | | |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| client_tokens_uuid_key | UNIQUE | UNIQUE (uuid) |

## Indexes

| Name | Definition |
| ---- | ---------- |
| client_tokens_uuid_key | CREATE UNIQUE INDEX client_tokens_uuid_key ON public.client_tokens USING btree (uuid) |

## Relations

![er](public.client_tokens.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
47 changes: 47 additions & 0 deletions dbdocs/bcda/public.client_tokens.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions dbdocs/bcda/public.encryption_keys.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# public.encryption_keys

## Description

## Columns

| Name | Type | Default | Nullable | Children | Parents | Comment |
| ---- | ---- | ------- | -------- | -------- | ------- | ------- |
| id | integer | nextval('encryption_keys_id_seq'::regclass) | false | | | |
| created_at | timestamp with time zone | | true | | | |
| updated_at | timestamp with time zone | | true | | | |
| deleted_at | timestamp with time zone | | true | | | |
| body | text | | true | | | |
| system_id | integer | | true | | [public.systems](public.systems.md) | |
| uuid | text | | true | | | |

## Constraints

| Name | Type | Definition |
| ---- | ---- | ---------- |
| encryption_keys_pkey | PRIMARY KEY | PRIMARY KEY (id) |
| encryption_keys_system_id_systems_id_foreign | FOREIGN KEY | FOREIGN KEY (system_id) REFERENCES systems(id) ON UPDATE RESTRICT ON DELETE RESTRICT |

## Indexes

| Name | Definition |
| ---- | ---------- |
| encryption_keys_pkey | CREATE UNIQUE INDEX encryption_keys_pkey ON public.encryption_keys USING btree (id) |
| idx_encryption_keys_deleted_at | CREATE INDEX idx_encryption_keys_deleted_at ON public.encryption_keys USING btree (deleted_at) |

## Relations

![er](public.encryption_keys.svg)

---

> Generated by [tbls](https://github.com/k1LoW/tbls)
Loading

0 comments on commit 5f3c176

Please sign in to comment.