Skip to content

Commit

Permalink
atlasaction: add revisions-schema input (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
noamcattan authored Nov 11, 2024
1 parent 27c8a93 commit 0ae4378
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 16 deletions.
35 changes: 19 additions & 16 deletions atlasaction/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ func (a *Actions) MigrateApply(ctx context.Context) error {
DirURL: a.GetInput("dir"),
URL: a.GetInput("url"),
DryRun: a.GetBoolInput("dry-run"),
RevisionsSchema: a.GetInput("revisions-schema"),
TxMode: a.GetInput("tx-mode"), // Hidden param.
BaselineVersion: a.GetInput("baseline"), // Hidden param.
}
Expand Down Expand Up @@ -272,16 +273,17 @@ const (
// MigrateDown runs the GitHub Action for "ariga/atlas-action/migrate/down".
func (a *Actions) MigrateDown(ctx context.Context) (err error) {
params := &atlasexec.MigrateDownParams{
ConfigURL: a.GetInput("config"),
Env: a.GetInput("env"),
Vars: a.GetVarsInput("vars"),
Context: a.DeployRunContext(),
DevURL: a.GetInput("dev-url"),
URL: a.GetInput("url"),
DirURL: a.GetInput("dir"),
ToVersion: a.GetInput("to-version"),
ToTag: a.GetInput("to-tag"),
Amount: a.GetUin64Input("amount"),
ConfigURL: a.GetInput("config"),
Env: a.GetInput("env"),
Vars: a.GetVarsInput("vars"),
Context: a.DeployRunContext(),
DevURL: a.GetInput("dev-url"),
URL: a.GetInput("url"),
DirURL: a.GetInput("dir"),
ToVersion: a.GetInput("to-version"),
ToTag: a.GetInput("to-tag"),
Amount: a.GetUin64Input("amount"),
RevisionsSchema: a.GetInput("revisions-schema"),
}
// Based on the retry configuration values, retry the action if there is an error.
var (
Expand Down Expand Up @@ -454,12 +456,13 @@ func (a *Actions) MigrateLint(ctx context.Context) error {
// MigrateTest runs the GitHub Action for "ariga/atlas-action/migrate/test"
func (a *Actions) MigrateTest(ctx context.Context) error {
result, err := a.Atlas.MigrateTest(ctx, &atlasexec.MigrateTestParams{
DirURL: a.GetInput("dir"),
DevURL: a.GetInput("dev-url"),
Run: a.GetInput("run"),
ConfigURL: a.GetInput("config"),
Env: a.GetInput("env"),
Vars: a.GetVarsInput("vars"),
DirURL: a.GetInput("dir"),
DevURL: a.GetInput("dev-url"),
Run: a.GetInput("run"),
ConfigURL: a.GetInput("config"),
Env: a.GetInput("env"),
Vars: a.GetVarsInput("vars"),
RevisionsSchema: a.GetInput("revisions-schema"),
})
if err != nil {
return fmt.Errorf("`atlas migrate test` completed with errors:\n%s", err)
Expand Down
3 changes: 3 additions & 0 deletions migrate/apply/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ inputs:
dry-run:
description: Print SQL without executing it. Either "true" or "false".
required: false
revisions-schema:
description: The name of the schema containing the revisions table.
required: false
outputs:
current:
description: The current version of the database. (before applying migrations)
Expand Down
3 changes: 3 additions & 0 deletions migrate/down/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ inputs:
wait-timeout:
description: Time after which no other retry attempt is made and the action exits.
required: false
revisions-schema:
description: The name of the schema containing the revisions table.
required: false
outputs:
current:
description: The current version of the database. (before applying migrations)
Expand Down
3 changes: 3 additions & 0 deletions migrate/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ inputs:
Filter tests to run by regexp. For example, `^test_.*` will only run tests that start with `test_`.
Default is to run all tests.
required: false
revisions-schema:
description: The name of the schema containing the revisions table.
required: false
runs:
using: node20
main: index.js

0 comments on commit 0ae4378

Please sign in to comment.