Database notes
What is verified
| Database | Dialect name | Verified how | Transactional DDL |
|---|---|---|---|
| SQLite | sqlite |
Full test suite in CI (blocking) | yes |
| PostgreSQL | postgres |
Full suite in a CI job that does not block merges yet | yes |
| MySQL | mysql |
Full suite in a CI job that does not block merges yet | no |
| MariaDB | mariadb |
Generated SQL unit-tested; never run on a live server | no |
| CockroachDB | cockroachdb |
Generated SQL unit-tested; never run on a live server | no (schema changes are not wrapped) |
| Redshift | redshift |
Generated SQL unit-tested; never run on a live server | yes |
| SQL Server | sqlserver |
Generated SQL unit-tested; never run on a live server | yes |
| Oracle | oracle |
Generated SQL unit-tested; never run on a live server | no |
“Never run on a live server” means the SQL migro produces is checked against expected fragments, but nobody has executed it against the real database yet. Expect to find rough edges there, and please report them or help verify.
“Transactional DDL” decides whether a migration runs inside a transaction (see Migrations). Where it is no, a migration that fails halfway can leave partial changes, so keep migrations small.
Per-database notes
- MySQL / MariaDB:
Increments/BigIncrementsareunsigned, so a foreign-key column must beInteger(...).Unsigned()/BigInteger(...).Unsigned()to match, otherwise MySQL rejects the constraint.ForeignIDalready does this. Enums are native. DDL is not transactional, so a migration that fails halfway leaves its earlier statements applied. An index on a column that already has a foreign key replaces the key’s automatic index, and MySQL then refuses to drop it (error 1553) until the key is gone. - SQLite: cannot add a foreign key or primary key to an existing table (
UNSUPPORTED_FEATURE); a unique constraint added withAlterTablebecomes a unique index. Pure Go driver, no cgo. - Redshift: no
CREATE INDEX(UNSUPPORTED_FEATURE); JSON maps toSUPER; keys useIDENTITY. Constraints are informational only. - SQL Server:
Enumisnvarcharplus aCHECK;Booleanisbit. - Oracle: identifiers are upper-cased;
Timeis stored asVARCHAR2(15)since Oracle has noTIMEtype. - CockroachDB: uses the PostgreSQL driver; schema changes are not wrapped in transactions.
DSN formats are on Connecting.