Skip to content

Commit 646d7da

Browse files
committed
Support reading default schema from the environment.
1 parent 16ab835 commit 646d7da

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/config/env.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,14 @@ func (c *Config) addEnvVars() error {
1313
}
1414
c.Cloud.AuthToken = authToken
1515

16+
defaultSchema := os.Getenv("SQLC_DEFAULT_SCHEMA")
17+
if defaultSchema != "" {
18+
for i, sql := range c.SQL {
19+
if sql.DefaultSchema == "" {
20+
c.SQL[i].DefaultSchema = defaultSchema
21+
}
22+
}
23+
}
24+
1625
return nil
1726
}

0 commit comments

Comments
 (0)