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
40001serialization 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.
| Database | Driver package | Locking | Transaction behavior | Migration record atomic with body |
|---|---|---|---|---|
| PostgreSQL | drivers/postgres | Production-ready advisory lock pinned to one connection | Yes | Yes |
| MySQL | drivers/mysql | GET_LOCK based | Depends on MySQL DDL semantics | No |
| SQLite | drivers/sqlite | Local/single-process use recommended | Yes for transactional statements | No |
| ClickHouse | drivers/clickhouse | Best-effort table guard | No true transaction support | No |
| CockroachDB | drivers/cockroachdb | Table row with expiry | Serializable transactions, retry handling still needs care | No |
| MSSQL | drivers/mssql | Application lock | Yes for transactional statements | No |
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.