Make cmd/sqlc-export-schema work again

Make `cmd/sqlc-export-schema` work again, by having it look at the first
schema it can find (instead of requiring that there is only one).
This commit is contained in:
Sybren A. Stüvel 2025-08-25 12:37:34 +02:00
parent 478e5affae
commit c7f71c7e3c

View File

@ -174,15 +174,15 @@ func schemaPathFromSqlcYAML() string {
Msg("unexpected version in sqlc.yaml") Msg("unexpected version in sqlc.yaml")
} }
if len(sqlcConfig.SQL) != 1 { if len(sqlcConfig.SQL) == 0 {
log.Fatal(). log.Fatal().
Int("sql items", len(sqlcConfig.SQL)). Int("sql items", len(sqlcConfig.SQL)).
Msg("sqlc.yaml should contain a single item in the 'sql' list") Msg("sqlc.yaml should contain at least one item in the 'sql' list")
} }
schema := sqlcConfig.SQL[0].Schema schema := sqlcConfig.SQL[0].Schema
if schema == "" { if schema == "" {
log.Fatal().Msg("sqlc.yaml should have a 'schema' key in the 'sql' item") log.Fatal().Msg("sqlc.yaml should have a 'schema' key in the first 'sql' item")
} }
return schema return schema