Skip to content

Commit

Permalink
atlasexec: replace log flag with format (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm authored Aug 14, 2023
1 parent aac65e9 commit eb4a224
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions atlasexec/atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func NewClientWithDir(workingDir, execPath string) (*Client, error) {

// Apply runs the 'migrate apply' command.
func (c *Client) Apply(ctx context.Context, data *ApplyParams) (*ApplyReport, error) {
args := []string{"migrate", "apply", "--log", "{{ json . }}"}
args := []string{"migrate", "apply", "--format", "{{ json . }}"}
if data.Env != "" {
args = append(args, "--env", data.Env)
}
Expand Down Expand Up @@ -197,7 +197,7 @@ func (c *Client) SchemaInspect(ctx context.Context, data *SchemaInspectParams) (

// Lint runs the 'migrate lint' command.
func (c *Client) Lint(ctx context.Context, data *LintParams) (*SummaryReport, error) {
args := []string{"migrate", "lint", "--log", "{{ json . }}"}
args := []string{"migrate", "lint", "--format", "{{ json . }}"}
if data.Env != "" {
args = append(args, "--env", data.Env)
}
Expand All @@ -219,7 +219,7 @@ func (c *Client) Lint(ctx context.Context, data *LintParams) (*SummaryReport, er

// Status runs the 'migrate status' command.
func (c *Client) Status(ctx context.Context, data *StatusParams) (*StatusReport, error) {
args := []string{"migrate", "status", "--log", "{{ json . }}"}
args := []string{"migrate", "status", "--format", "{{ json . }}"}
if data.Env != "" {
args = append(args, "--env", data.Env)
}
Expand Down
5 changes: 3 additions & 2 deletions atlasexec/atlas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ func Test_MigrateApply(t *testing.T) {
})
c, err := atlasexec.NewClientWithDir(ec.Path(), "atlas")
require.NoError(t, err)
_, err = c.Apply(context.Background(), &atlasexec.ApplyParams{
got, err := c.Apply(context.Background(), &atlasexec.ApplyParams{
Env: "test",
})
require.EqualError(t, err, `atlasexec: required flag "url" not set`)
require.Nil(t, got)
// Set the env var and try again
os.Setenv("DB_URL", "sqlite://file?_fk=1&cache=shared&mode=memory")
got, err := c.Apply(context.Background(), &atlasexec.ApplyParams{
got, err = c.Apply(context.Background(), &atlasexec.ApplyParams{
Env: "test",
})
require.NoError(t, err)
Expand Down

0 comments on commit eb4a224

Please sign in to comment.