Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlc vet reports schema does not exist unless it's created in migrations #3571

Open
ribtoks opened this issue Sep 2, 2024 · 0 comments
Open

Comments

@ribtoks
Copy link

ribtoks commented Sep 2, 2024

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

@ribtoks ribtoks added the bug Something isn't working label Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant