-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: override config to support multi db/schema in on repository (#3)
* feat: override config to support multi db/schema in on repo * doc: update commands
- Loading branch information
Showing
17 changed files
with
351 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TBLS_DATABASE_NAME=db-example | ||
TBLS_DATABASE_SCHEMA=example2_schema | ||
TBLS_MIGRATION_DIR=example/migrations | ||
TBLS_CONFIG_FILE=example2.tbls.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/.env | ||
/*.env | ||
dist/ | ||
|
||
dist/ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dbdoc: | ||
@echo "generate schema example" | ||
go run cmd/tblsrun/tblsrun.go postgres docker | ||
@echo "generate schema example 2" | ||
go run cmd/tblsrun/tblsrun.go --env-file=.env.example_2 postgres docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"name":"db-example","desc":"","tables":[{"name":"example_schema.schema_migrations","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_pkey","def":"CREATE UNIQUE INDEX schema_migrations_pkey ON example_schema.schema_migrations USING btree (version)","table":"example_schema.schema_migrations","columns":["version"],"comment":""}],"constraints":[{"name":"schema_migrations_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (version)","table":"example_schema.schema_migrations","referenced_table":"","columns":["version"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""},{"name":"example_schema.example","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('example_id_seq'::regclass)","comment":""},{"name":"name","type":"varchar(255)","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"example_pkey","def":"CREATE UNIQUE INDEX example_pkey ON example_schema.example USING btree (id)","table":"example_schema.example","columns":["id"],"comment":""}],"constraints":[{"name":"example_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"example_schema.example","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""},{"name":"example_schema.example_2","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('example_2_id_seq'::regclass)","comment":""},{"name":"name","type":"varchar(255)","nullable":false,"default":null,"comment":""},{"name":"example_1_id","type":"integer","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"example_2_pkey","def":"CREATE UNIQUE INDEX example_2_pkey ON example_schema.example_2 USING btree (id)","table":"example_schema.example_2","columns":["id"],"comment":""}],"constraints":[{"name":"example_2_example_1_id_fkey","type":"FOREIGN KEY","def":"FOREIGN KEY (example_1_id) REFERENCES example(id)","table":"example_schema.example_2","referenced_table":"example","columns":["example_1_id"],"referenced_columns":["id"],"comment":""},{"name":"example_2_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"example_schema.example_2","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""}],"relations":[{"table":"example_schema.example_2","columns":["example_1_id"],"cardinality":"Zero or more","parent_table":"example_schema.example","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (example_1_id) REFERENCES example(id)","virtual":false}],"functions":[],"driver":{"name":"postgres","database_version":"PostgreSQL 13.9 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, 64-bit","meta":{"current_schema":"example_schema","search_paths":["example_schema"],"dict":{"Functions":"Stored procedures and functions"}}}} | ||
{"name":"db-example","desc":"","tables":[{"name":"example_schema.schema_migrations","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_pkey","def":"CREATE UNIQUE INDEX schema_migrations_pkey ON example_schema.schema_migrations USING btree (version)","table":"example_schema.schema_migrations","columns":["version"],"comment":""}],"constraints":[{"name":"schema_migrations_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (version)","table":"example_schema.schema_migrations","referenced_table":"","columns":["version"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""},{"name":"example_schema.example","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('example_id_seq'::regclass)","comment":""},{"name":"name","type":"varchar(255)","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"example_pkey","def":"CREATE UNIQUE INDEX example_pkey ON example_schema.example USING btree (id)","table":"example_schema.example","columns":["id"],"comment":""}],"constraints":[{"name":"example_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"example_schema.example","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""},{"name":"example_schema.example_2","type":"BASE TABLE","comment":"","columns":[{"name":"id","type":"integer","nullable":false,"default":"nextval('example_2_id_seq'::regclass)","comment":""},{"name":"name","type":"varchar(255)","nullable":false,"default":null,"comment":""},{"name":"example_1_id","type":"integer","nullable":false,"default":null,"comment":""}],"indexes":[{"name":"example_2_pkey","def":"CREATE UNIQUE INDEX example_2_pkey ON example_schema.example_2 USING btree (id)","table":"example_schema.example_2","columns":["id"],"comment":""}],"constraints":[{"name":"example_2_example_1_id_fkey","type":"FOREIGN KEY","def":"FOREIGN KEY (example_1_id) REFERENCES example(id)","table":"example_schema.example_2","referenced_table":"example","columns":["example_1_id"],"referenced_columns":["id"],"comment":""},{"name":"example_2_pkey","type":"PRIMARY KEY","def":"PRIMARY KEY (id)","table":"example_schema.example_2","referenced_table":"","columns":["id"],"referenced_columns":[],"comment":""}],"triggers":[],"def":""}],"relations":[{"table":"example_schema.example_2","columns":["example_1_id"],"cardinality":"Zero or more","parent_table":"example_schema.example","parent_columns":["id"],"parent_cardinality":"Exactly one","def":"FOREIGN KEY (example_1_id) REFERENCES example(id)","virtual":false}],"functions":[],"driver":{"name":"postgres","database_version":"PostgreSQL 13.8 (Debian 13.8-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit","meta":{"current_schema":"example_schema","search_paths":["example_schema"],"dict":{"Functions":"Stored procedures and functions"}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Path to generate document | ||
docPath: example2/dbdoc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# db-example | ||
|
||
## Tables | ||
|
||
| Name | Columns | Comment | Type | | ||
| ---- | ------- | ------- | ---- | | ||
| [example2_schema.schema_migrations](example2_schema.schema_migrations.md) | 2 | | BASE TABLE | | ||
| [example2_schema.example](example2_schema.example.md) | 2 | | BASE TABLE | | ||
| [example2_schema.example_2](example2_schema.example_2.md) | 3 | | BASE TABLE | | ||
|
||
## Relations | ||
|
||
![er](schema.svg) | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# example2_schema.example | ||
|
||
## Description | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---- | ---- | ------- | -------- | -------- | ------- | ------- | | ||
| id | integer | nextval('example_id_seq'::regclass) | false | [example2_schema.example_2](example2_schema.example_2.md) | | | | ||
| name | varchar(255) | | false | | | | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ---- | ---- | ---------- | | ||
| example_pkey | PRIMARY KEY | PRIMARY KEY (id) | | ||
|
||
## Indexes | ||
|
||
| Name | Definition | | ||
| ---- | ---------- | | ||
| example_pkey | CREATE UNIQUE INDEX example_pkey ON example2_schema.example USING btree (id) | | ||
|
||
## Relations | ||
|
||
![er](example2_schema.example.svg) | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# example2_schema.example_2 | ||
|
||
## Description | ||
|
||
## Columns | ||
|
||
| Name | Type | Default | Nullable | Children | Parents | Comment | | ||
| ---- | ---- | ------- | -------- | -------- | ------- | ------- | | ||
| id | integer | nextval('example_2_id_seq'::regclass) | false | | | | | ||
| name | varchar(255) | | false | | | | | ||
| example_1_id | integer | | false | | [example2_schema.example](example2_schema.example.md) | | | ||
|
||
## Constraints | ||
|
||
| Name | Type | Definition | | ||
| ---- | ---- | ---------- | | ||
| example_2_example_1_id_fkey | FOREIGN KEY | FOREIGN KEY (example_1_id) REFERENCES example(id) | | ||
| example_2_pkey | PRIMARY KEY | PRIMARY KEY (id) | | ||
|
||
## Indexes | ||
|
||
| Name | Definition | | ||
| ---- | ---------- | | ||
| example_2_pkey | CREATE UNIQUE INDEX example_2_pkey ON example2_schema.example_2 USING btree (id) | | ||
|
||
## Relations | ||
|
||
![er](example2_schema.example_2.svg) | ||
|
||
--- | ||
|
||
> Generated by [tbls](https://github.com/k1LoW/tbls) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.