Commit 5118e16 1 parent b9a3589 commit 5118e16 Copy full SHA for 5118e16
File tree 3 files changed +36
-9
lines changed
3 files changed +36
-9
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ name: Database Migrations
3
3
on :
4
4
push :
5
5
branches :
6
- - main
6
+ - ' *'
7
+ paths :
8
+ - ' packages/schema/**'
9
+ pull_request :
7
10
paths :
8
11
- ' packages/schema/**'
9
12
workflow_dispatch :
@@ -14,6 +17,29 @@ permissions:
14
17
packages : read
15
18
16
19
jobs :
20
+ check-migrations :
21
+ name : Check migrations
22
+ runs-on : ubuntu-latest
23
+
24
+ steps :
25
+ - uses : actions/checkout@v4
26
+ - uses : pnpm/action-setup@v4
27
+ with :
28
+ version : 8
29
+ - uses : actions/setup-node@v4
30
+ with :
31
+ node-version : ' 20'
32
+ cache : " pnpm"
33
+
34
+ - name : Install dependencies
35
+ run : pnpm install
36
+
37
+ - name : Lint or check migrations
38
+ working-directory : ./packages/schema
39
+ run : pnpm migrate:check
40
+ env :
41
+ DATABASE_URL : ${{ secrets.DATABASE_URL }}
42
+
17
43
apply-migrations :
18
44
name : Apply migrations
19
45
runs-on : ubuntu-latest
@@ -27,18 +53,18 @@ jobs:
27
53
with :
28
54
node-version : ' 20'
29
55
cache : " pnpm"
30
-
56
+
31
57
- name : Install dependencies
32
58
run : pnpm install
33
-
59
+
34
60
- uses : aws-actions/configure-aws-credentials@v4
35
61
with :
36
62
aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
37
63
aws-region : ${{ vars.AWS_REGION }}
38
64
aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
39
-
65
+
40
66
- name : Run migrations
41
67
working-directory : ./packages/schema
42
68
run : pnpm migrate
43
69
env :
44
- DATABASE_URL : ${{ secrets.DATABASE_URL }}
70
+ DATABASE_URL : ${{ secrets.DATABASE_URL }}
Original file line number Diff line number Diff line change @@ -5,6 +5,6 @@ CREATE TABLE IF NOT EXISTS "coe_pqp" (
5
5
" pqp" integer
6
6
);
7
7
-- > statement-breakpoint
8
- CREATE INDEX "pqp_month_vehicle_class_idx " ON " coe_pqp" USING btree (" month" ," vehicle_class" );-- > statement-breakpoint
9
- CREATE INDEX "pqp_vehicle_class_idx " ON " coe_pqp" USING btree (" vehicle_class" );-- > statement-breakpoint
10
- CREATE INDEX "pqp_idx " ON " coe_pqp" USING btree (" pqp" );
8
+ CREATE INDEX IF NOT EXISTS " pqp_month_vehicle_class_idx" ON " coe_pqp" USING btree (" month" ," vehicle_class" );-- > statement-breakpoint
9
+ CREATE INDEX IF NOT EXISTS " pqp_vehicle_class_idx" ON " coe_pqp" USING btree (" vehicle_class" );-- > statement-breakpoint
10
+ CREATE INDEX IF NOT EXISTS " pqp_idx" ON " coe_pqp" USING btree (" pqp" );
Original file line number Diff line number Diff line change 4
4
"private" : true ,
5
5
"main" : " src/index.ts" ,
6
6
"scripts" : {
7
- "migrate" : " drizzle-kit migrate"
7
+ "migrate" : " drizzle-kit migrate" ,
8
+ "migrate:check" : " drizzle-kit check"
8
9
},
9
10
"author" :
" Ru Chern Chong <[email protected] >" ,
10
11
"license" : " MIT" ,
You can’t perform that action at this time.
0 commit comments