Skip to main content

Drivers

Queen supports several databases, but the production contract is intentionally PostgreSQL-first.

Start with Support Matrix when comparing driver guarantees. Current limitations to keep in mind:

  • SQLite locking is for local/single-process use, not distributed coordination.
  • ClickHouse locking is best-effort; keep deployment migrators serialized.
  • CockroachDB can return retryable 40001 serialization errors; explicit driver retry handling is still planned.
  • Non-PostgreSQL drivers do not currently record the migration row in the same transaction as the migration body.

The detailed edge list lives in Known Limitations.

DatabaseDriver packageLockingTransaction behaviorMigration record atomic with body
PostgreSQLdrivers/postgresProduction-ready advisory lock pinned to one connectionYesYes
MySQLdrivers/mysqlGET_LOCK basedDepends on MySQL DDL semanticsNo
SQLitedrivers/sqliteLocal/single-process use recommendedYes for transactional statementsNo
ClickHousedrivers/clickhouseBest-effort table guardNo true transaction supportNo
CockroachDBdrivers/cockroachdbTable row with expirySerializable transactions, retry handling still needs careNo
MSSQLdrivers/mssqlApplication lockYes for transactional statementsNo

PostgreSQL

Use PostgreSQL when you need the strongest Queen behavior today:

  • advisory lock pinned to one connection;
  • SQL and Go-function migration body inside a transaction;
  • migration record written in the same transaction as the migration body;
  • pgxpool adapter support.
q := queen.New(postgres.New(db))

Detailed page: PostgreSQL Driver.

MySQL

MySQL uses GET_LOCK on a pinned connection and normal database/sql transaction execution. DDL rollback behavior follows MySQL rules.

Detailed page: MySQL Driver.

SQLite

SQLite is useful for tests, local tools, and single-process applications. Do not treat the current SQLite lock path as distributed coordination between multiple migrator processes.

Detailed page: SQLite Driver.

ClickHouse

ClickHouse does not provide the same transaction model as PostgreSQL. Treat its migration lock as a best-effort guard and keep migrations operationally serialized.

Detailed page: ClickHouse Driver.

CockroachDB

CockroachDB can return retryable 40001 serialization failures. Plan for retry-aware deployment behavior until the driver has explicit retry handling.

Detailed page: CockroachDB Driver.

MS SQL Server

MSSQL uses sp_getapplock / sp_releaseapplock on a pinned session connection.

Detailed page: MS SQL Server Driver.