Skip to content

Commit

Permalink
fix(verify): Include database engine in request
Browse files Browse the repository at this point in the history
Also print out more error info by default
  • Loading branch information
kyleconroy committed Aug 5, 2024
1 parent 1db27a5 commit ce0464b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var verifyCmd = &cobra.Command{
Against: against,
}
if err := Verify(cmd.Context(), dir, name, opts); err != nil {
fmt.Fprintf(stderr, "Error verifying queries: %s\n", err)
os.Exit(1)
}
return nil
Expand Down Expand Up @@ -111,6 +112,7 @@ func Verify(ctx context.Context, dir, filename string, opts *Options) error {

// Create (or re-use) a database to verify against
resp, err := manager.CreateDatabase(ctx, &dbmanager.CreateDatabaseRequest{
Engine: string(current.Engine),
Migrations: ddl,
})
if err != nil {
Expand Down Expand Up @@ -144,6 +146,7 @@ func Verify(ctx context.Context, dir, filename string, opts *Options) error {
if err := check(); err != nil {
verr = errors.New("errored")
fmt.Fprintf(stderr, "FAIL\t%s\n", qs.Name)
fmt.Fprintf(stderr, " ERROR\t%s\n", err)
} else {
fmt.Fprintf(stderr, "ok\t%s\n", qs.Name)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/dbmanager/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (m *ManagedClient) CreateDatabase(ctx context.Context, req *CreateDatabaseR
case config.EnginePostgreSQL:
// pass
default:
return nil, fmt.Errorf("unsupported the %s engine", engine)
return nil, fmt.Errorf("unsupported engine: %s", engine)
}

var base string
Expand Down

0 comments on commit ce0464b

Please sign in to comment.