Skip to content

Commit 1a014c7

Browse files
authored
Merge pull request #34 from getmarkus/cm-branch-32
feat(db): add issue_analysis schema and issue table with migration setup
2 parents c13ffee + 8348498 commit 1a014c7

File tree

5 files changed

+35
-2
lines changed

5 files changed

+35
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,4 @@ Temporary Items
206206
*.sqlite-journal
207207
*.sqlite3-journal
208208
*.db-journal
209-
*.sql
209+
analyze.sql

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ atlas schema inspect -u "postgres://app_user:change_this_password@localhost:5432
1818
atlas schema apply --url "sqlite://issues.db" --to "file://migrate.sql" --dev-url "sqlite://file?mode=memory" --dry-run
1919
atlas schema apply --url "sqlite://issues.db" --to "file://migrate.sql" --dev-url "sqlite://file?mode=memory"
2020

21-
atlas schema apply --url "postgres://app_user:change_this_password@localhost:5432/app_database?sslmode=disable" --to "file://migrate.sql" --dev-url "docker://postgres/17" --dry-run
21+
atlas schema apply --url "postgres://app_user:change_this_password@localhost:5432/app_database?sslmode=disable" --to "file://./migrations/migrate.sql" --dev-url "docker://postgres/17" --dry-run
22+
atlas schema apply --url "postgres://app_user:change_this_password@localhost:5432/app_database?sslmode=disable" --to "file://./migrations/migrate.sql" --dev-url "docker://postgres/17"
2223
```
2324

2425
```mermaid

docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,28 @@ services:
2727
networks:
2828
- app_network
2929

30+
atlas:
31+
image: arigaio/atlas:latest
32+
container_name: atlas_migrations
33+
depends_on:
34+
db:
35+
condition: service_healthy
36+
env_file:
37+
- .env
38+
volumes:
39+
- ./migrations:/migrations
40+
command: >
41+
migrate apply
42+
--url "postgres://${POSTGRES_SUPER_USER}:${POSTGRES_SUPER_PASSWORD}@db:5432/${POSTGRES_DB}?sslmode=disable"
43+
--dir "file:///migrations"
44+
networks:
45+
- app_network
46+
3047
volumes:
3148
postgres_data:
3249
name: postgres_data
50+
postgres_data_dev:
51+
name: postgres_data_dev
3352

3453
networks:
3554
app_network:

migrations/atlas.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
h1:Ey773GArjuY1VXrV0JPiw735MWDy1WliOVfb9GTgp6I=
2+
migrate.sql h1:QcfhJKGaQInbgbjFZCIgva/1LxeC8HjdFVZtPoWbvyA=

migrations/migrate.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Create the schema
2+
CREATE SCHEMA IF NOT EXISTS "issue_analysis";
3+
4+
-- Create "issue" table in the issue_analysis schema
5+
CREATE TABLE "issue_analysis"."issue" (
6+
"version" integer NOT NULL,
7+
"issue_number" integer NOT NULL,
8+
"issue_state" varchar NOT NULL,
9+
PRIMARY KEY ("issue_number")
10+
);
11+

0 commit comments

Comments
 (0)