Import Goose Migrations
Queen can convert goose SQL migrations into Go migration files.
go run ./cmd/migrate import ./db/migrations --from goose --output migrations --dry-run
go run ./cmd/migrate import ./db/migrations --from goose --output migrations
The importer supports .sql files with goose sections:
-- +goose Up
CREATE TABLE users (
id BIGSERIAL PRIMARY KEY,
email TEXT NOT NULL UNIQUE
);
-- +goose Down
DROP TABLE users;
Queen preserves the version prefix from the goose filename, including timestamp versions such as:
20240524054622_create_users.sql
The converted output is a Go file that registers a queen.M with UpSQL and DownSQL.
Import does not overwrite generated files. If migrations.go or a target migration file already exists, the command fails and leaves the existing file intact.
Goose Go migrations are not converted automatically. Port them manually to UpFunc and DownFunc, and add ManualChecksum.