Skip to content

Commit

Permalink
fix(vet): Remove rollback statements from DDL (#2895)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy authored Oct 20, 2023
1 parent 11a82f0 commit e84018d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/cmd/vet.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (

"github.com/sqlc-dev/sqlc/internal/config"
"github.com/sqlc-dev/sqlc/internal/debug"
"github.com/sqlc-dev/sqlc/internal/migrations"
"github.com/sqlc-dev/sqlc/internal/opts"
"github.com/sqlc-dev/sqlc/internal/plugin"
"github.com/sqlc-dev/sqlc/internal/quickdb"
Expand Down Expand Up @@ -414,7 +415,7 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f
c.Client = client
}

var migrations []string
var ddl []string
files, err := sqlpath.Glob(s.Schema)
if err != nil {
return "", cleanup, err
Expand All @@ -424,13 +425,13 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f
if err != nil {
return "", cleanup, fmt.Errorf("read file: %w", err)
}
migrations = append(migrations, string(contents))
ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents)))
}

resp, err := c.Client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{
Engine: "postgresql",
Region: quickdb.GetClosestRegion(),
Migrations: migrations,
Migrations: ddl,
})
if err != nil {
return "", cleanup, fmt.Errorf("managed: create database: %w", err)
Expand Down

0 comments on commit e84018d

Please sign in to comment.