Skip to content

Add a duckdb-compliant dialect #1010

@mfridman

Description

@mfridman

It's unfortunate the sqlite schema uses AUTOINCREMENT, since this is not supported in duckdb (which is fine!).

duckdb/duckdb#15436

For background, see:
https://duckdb.org/docs/stable/sql/statements/create_sequence
https://duckdb.org/docs/stable/sql/constraints

But I want to use goose with duckdb, and so we should figure out how to get this to work.


To support DuckDB, the version table creation needs to use sequences:

CREATE SEQUENCE IF NOT EXISTS goose_db_version_id_seq START 1;

CREATE TABLE goose_db_version (
    id INTEGER PRIMARY KEY DEFAULT nextval('goose_db_version_id_seq'),
    version_id INTEGER NOT NULL,
    is_applied INTEGER NOT NULL,
    tstamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

Can't use the other dialects because:

  • No AUTOINCREMENT (SQLite)
  • No GENERATED BY DEFAULT AS IDENTITY (Postgres)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions