goose icon indicating copy to clipboard operation
goose copied to clipboard

Add a duckdb-compliant dialect

Open mfridman opened this issue 1 month ago • 0 comments

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

https://github.com/duckdb/duckdb/issues/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)

mfridman avatar Dec 03 '25 02:12 mfridman