File tree Expand file tree Collapse file tree 6 files changed +42
-24
lines changed
Expand file tree Collapse file tree 6 files changed +42
-24
lines changed Original file line number Diff line number Diff line change @@ -95,14 +95,16 @@ jobs:
9595 with :
9696 fetch-depth : 0
9797
98- - name : Setup Atlas
99- uses : ariga/setup-atlas@4240bd74ba9f13319a21de2b6e497f2b6d184d76 # v0
98+ - name : Setup Atlas community edition
99+ run : |
100+ curl -sSf https://atlasgo.sh | sh -s -- --community --yes
101+ shell : bash
100102
101103 - name : Atlas Lint
102104 run : |
103105 set +e
104106
105- LINT_OUTPUT="$(atlas migrate lint --env ci 2>&1)"
107+ LINT_OUTPUT="$(atlas migrate lint --config file://atlas.ci.hcl -- env ci 2>&1)"
106108 LINT_EXIT_CODE=$?
107109
108110 if [ "$LINT_EXIT_CODE" -eq 0 ]; then
Original file line number Diff line number Diff line change 1- version : " 3 "
1+ version : ' 3 '
22
33includes :
44 os :
@@ -92,19 +92,14 @@ tasks:
9292 migrate:new :
9393 cmds :
9494 - task : os:migrate:new
95- desc : " マイグレーションファイルを生成する。名前を指定できる。 (task migrate:new -- <migration_name>)"
95+ desc : ' マイグレーションファイルを生成する。名前を指定できる。 (task migrate:new -- <migration_name>)'
9696
9797 migrate:down :
9898 cmds :
9999 - task : os:migrate:down
100- desc : " マイグレーションを1つ戻して、マイグレーションファイルを削除する"
100+ desc : ' マイグレーションを1つ戻して、マイグレーションファイルを削除する'
101101
102102 migrate:down:down-only :
103103 cmds :
104104 - task : os:migrate:down:down-only
105- desc : " マイグレーションを1つ戻すが、マイグレーションファイルは削除しない"
106-
107- migrate:lint :
108- cmds :
109- - task : os:migrate:lint
110- desc : " マイグレーションの Lint を実行する"
105+ desc : ' マイグレーションを1つ戻すが、マイグレーションファイルは削除しない'
Original file line number Diff line number Diff line change 1+ lint {
2+ non_linear {
3+ error = true
4+ }
5+ }
6+
7+ env "local" {
8+ dev = " docker://mariadb/10.7/trap_collection"
9+
10+ migration {
11+ dir = " file://migrations"
12+ }
13+
14+ lint {
15+ git {
16+ base = " origin/main"
17+ }
18+ }
19+ }
20+
21+ env "ci" {
22+ dev = " mysql://root:pass@localhost:3306/trap_collection"
23+
24+ lint {
25+ git {
26+ base = " origin/main"
27+ }
28+ }
29+ }
Original file line number Diff line number Diff line change @@ -70,10 +70,12 @@ task migrate:down:down-only
7070## マイグレーションの Lint
7171
7272Atlas の Lint 機能を使って、マイグレーションファイルのチェックを行うことができます。
73+ ただし、通常の Atlas CLI の free plan では、Lint 機能を使うことができません。必要であれば community edition をインストールして使ってください。
74+ GitHub Actions の CI では community edition を使って Lint を実行しています。
7375以下のコマンドを実行してください。
7476
7577``` bash
76- task migrate: lint
78+ atlas migrate lint --config file://atlas.ci.hcl --env local
7779```
7880
7981このコマンドでは、main ブランチと比較してマイグレーションが正しいかをチェックします。
Original file line number Diff line number Diff line change @@ -101,8 +101,3 @@ tasks:
101101 dir : ../
102102 cmds :
103103 - atlas migrate down --env local
104-
105- migrate:lint :
106- dir : ../
107- cmds :
108- - atlas migrate lint --env local --git-base main
Original file line number Diff line number Diff line change 1- version : " 3 "
1+ version : ' 3 '
22
33tasks :
44 download :
@@ -101,8 +101,3 @@ tasks:
101101 dir : ..\
102102 cmds :
103103 - atlas migrate down --env local
104-
105- migrate:lint :
106- dir : ..\
107- cmds :
108- - atlas migrate lint --env local --git-base main
You can’t perform that action at this time.
0 commit comments