sqlc
sqlc copied to clipboard
sqlc vet reports schema does not exist unless it's created in migrations
Version
1.27.0
What happened?
Hi
Thank you for developing sqlc!
I work with Postgres. I use init script to provision a database, a non-admin user and non-public schema. Everything else (tables, triggers etc.) is done in migrations. All migrations reference tables using a schema. I used to have this "init" script as the first migration but now for certain reasons it moved out.
sqlc vet (using a local/docker DB) used to work correctly back then, but now when migration is out, it reports "Schema <xyz> does not exist" on every migration file. After a lot of debugging, I found a hotfix to add CREATE SCHEMA IF NOT EXISTS xyz; before running sqlc vet to a "fake" first migration (and delete it afterwards).
Would be great if it worked without that workaround..
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
version: "2"
sql:
- engine: "postgresql"
queries: "queries/postgres"
schema: "migrations/postgres"
database:
uri: "${POSTGRES_DSN}"
rules:
- sqlc/db-prepare
gen:
go:
package: "generated"
sql_package: "pgx/v5"
out: "generated"
Playground URL
No response
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go