Skip to content

Commit e84018d

Browse files
authored
fix(vet): Remove rollback statements from DDL (#2895)
1 parent 11a82f0 commit e84018d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/cmd/vet.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424

2525
"github.com/sqlc-dev/sqlc/internal/config"
2626
"github.com/sqlc-dev/sqlc/internal/debug"
27+
"github.com/sqlc-dev/sqlc/internal/migrations"
2728
"github.com/sqlc-dev/sqlc/internal/opts"
2829
"github.com/sqlc-dev/sqlc/internal/plugin"
2930
"github.com/sqlc-dev/sqlc/internal/quickdb"
@@ -414,7 +415,7 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f
414415
c.Client = client
415416
}
416417

417-
var migrations []string
418+
var ddl []string
418419
files, err := sqlpath.Glob(s.Schema)
419420
if err != nil {
420421
return "", cleanup, err
@@ -424,13 +425,13 @@ func (c *checker) fetchDatabaseUri(ctx context.Context, s config.SQL) (string, f
424425
if err != nil {
425426
return "", cleanup, fmt.Errorf("read file: %w", err)
426427
}
427-
migrations = append(migrations, string(contents))
428+
ddl = append(ddl, migrations.RemoveRollbackStatements(string(contents)))
428429
}
429430

430431
resp, err := c.Client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{
431432
Engine: "postgresql",
432433
Region: quickdb.GetClosestRegion(),
433-
Migrations: migrations,
434+
Migrations: ddl,
434435
})
435436
if err != nil {
436437
return "", cleanup, fmt.Errorf("managed: create database: %w", err)

0 commit comments

Comments
 (0)