File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed
internal/data/ent/migrate/migrations Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -38,14 +38,14 @@ jobs:
3838
3939 # Generate any possible migration from a schema change that way
4040 # we can detect any migration file that has not been checked in to git
41- # This could happen if the developer ran make generate but didn't run make migration_new
41+ # This could happen if the developer ran make generate but didn't run make migration_sync
4242 - name : Generate migrations
4343 if : ${{ matrix.app == 'controlplane' }}
4444 run : |
4545 wget -q https://release.ariga.io/atlas/atlas-linux-amd64-latest -O /tmp/atlas
4646 sudo install /tmp/atlas /usr/local/bin/atlas
4747
48- make -C app/controlplane migration_new
48+ make -C app/controlplane migration_sync
4949
5050 # Check that the generated ent code is up to date
5151 # see https://entgo.io/docs/ci/
Original file line number Diff line number Diff line change @@ -33,10 +33,15 @@ migration_apply: check-atlas-tool migration_hash
3333 atlas migrate status --dir ${local_migrations_dir} --url ${local_db}
3434 atlas migrate apply --dir ${local_migrations_dir} --url ${local_db}
3535
36+ .PHONY : migration_sync
37+ # sync migration files with the current ent schema
38+ migration_sync : check-atlas-tool migration_hash
39+ atlas migrate diff --dir ${local_migrations_dir} --to " ent://internal/data/ent/schema" --dev-url " docker://postgres/15/test?search_path=public"
40+
3641.PHONY : migration_new
37- # generate new migration if needed from the current ent schema
42+ # generate an empty migration file
3843migration_new : check-atlas-tool migration_hash
39- atlas migrate diff --dir ${local_migrations_dir} --to " ent://internal/data/ent/schema " --dev-url " docker://postgres/15/test?search_path=public "
44+ atlas migrate new --dir ${local_migrations_dir}
4045
4146.PHONY : migration_hash
4247migration_hash : check-atlas-tool
@@ -61,7 +66,7 @@ lint: check-golangci-lint-tool check-buf-tool
6166
6267.PHONY : generate
6368# generate proto bindings, wire injectors, and ent models
64- generate : check-wire-tool api config migration_new
69+ generate : check-wire-tool api config migration_sync
6570 go generate ./...
6671
6772.PHONY : all
Original file line number Diff line number Diff line change 1+ -- Updates the contract_revision_used field in workflow_runs to the revision of the contract version used in the run
2+ -- for existing values in the database if it is not set (0)
3+ UPDATE workflow_runs
4+ SET contract_revision_used = wcv .revision
5+ FROM workflow_contract_versions wcv
6+ WHERE workflow_runs .contract_revision_used = 0
7+ AND workflow_runs .workflow_run_contract_version = wcv .id ;
Original file line number Diff line number Diff line change 1- h1:mf+rCMij2DFHC9ogu8h+ktB0OPUSBAanvHQeIAoPfc4 =
1+ h1:PTn2PGzCqghqtloTCXyt2mqCL53gJMrZ0h7j77qU2H0 =
2220230706165452_init-schema.sql h1:VvqbNFEQnCvUVyj2iDYVQQxDM0+sSXqocpt/5H64k8M=
3320230710111950-cas-backend.sql h1:A8iBuSzZIEbdsv9ipBtscZQuaBp3V5/VMw7eZH6GX+g=
4420230712094107-cas-backends-workflow-runs.sql h1:a5rzxpVGyd56nLRSsKrmCFc9sebg65RWzLghKHh5xvI=
@@ -23,3 +23,4 @@ h1:mf+rCMij2DFHC9ogu8h+ktB0OPUSBAanvHQeIAoPfc4=
232320240226145219.sql h1:m90QJxxZjOC7CjMPijxc3vf5pzX1X6Ac9M8Ms0lJ0gQ=
242420240228152445.sql h1:+F9k29PxJCv4CuwoMcnO24y0a+mxqaWsJr2zgI8XDx0=
252520240229202352.sql h1:1oSaJh+gNJ8cc+9AGBizFG4uk6GkHph0R3hsjjz9w4g=
26+ 20240303145130.sql h1:ejcuI4AeWNCNhEkg3+7ButLe2hpIFqmhuPheFXEr6zY=
You can’t perform that action at this time.
0 commit comments