Skip to content

Commit a87a418

Browse files
committed
feat: parse schema for syntax validation only in database-only mode
In database-only mode, parse the schema migrations to validate syntax and collect them for the database connection, but skip updating the catalog. The database will be the source of truth for schema information. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4668db9 commit a87a418

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/compiler/compile.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,19 @@ func (c *Compiler) parseCatalog(schemas []string) error {
4141
contents := migrations.RemoveRollbackStatements(string(blob))
4242
c.schema = append(c.schema, contents)
4343

44+
// In database-only mode, we parse the schema to validate syntax
45+
// but don't update the catalog - the database will be the source of truth
4446
stmts, err := c.parser.Parse(strings.NewReader(contents))
4547
if err != nil {
4648
merr.Add(filename, contents, 0, err)
4749
continue
4850
}
51+
52+
// Skip catalog updates in database-only mode
53+
if c.databaseOnlyMode {
54+
continue
55+
}
56+
4957
for i := range stmts {
5058
if err := c.catalog.Update(stmts[i], c); err != nil {
5159
merr.Add(filename, contents, stmts[i].Pos(), err)

0 commit comments

Comments
 (0)