Skip to content

Update documentation for name/up.sql and name/down.sql migrations #3771

Open
@SamWhited

Description

@SamWhited

What do you want to change?

In two different projects I'm using two different migration systems that both keep migrations in separate directories that are walked in lexical order with up.sql and down.sql files in those directories. For example, the first migration might be: migrations/01_init/up.sql and migrations/01_init/down.sql.

When I run sqlc it complains that the schema or tables or what not don't exist, presumably because it's not actually picking up the migration files when I set schema: migrations/ (I was unable to find any way to verify that this is actually what's going on, but the documentation doesn't mention this type of migration).

It would be nice if sqlc could support finding migrations in up/down files in individual directories. Thanks!

What database engines need to be changed?

PostgreSQL

What programming language backends need to be changed?

Go

sqlc.yaml: version: "2" sql: - engine: "postgresql" queries: "query.sql" schema: "migrations/" gen: go: package: "store" sql_package: "pgx/v5" out: "internal/store"

sqlc version: v1.27.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions