Multi-database support
SQLite is the default and needs no setup. For larger deployments or company standards, switch to MySQL or PostgreSQL in data/data.yaml.
Supported engines
| Driver | Version | Implementation | Notes |
|---|---|---|---|
sqlite | built-in | modernc.org/sqlite (pure Go) | default, file data/data.db |
mysql | MySQL 8.0.13+ / MariaDB 10.6+ | github.com/go-sql-driver/mysql | utf8mb4, InnoDB recommended |
postgres | PostgreSQL 13+ | github.com/lib/pq | ? placeholders are rebound to $1..$n |
Why MySQL 8.0.13+
Text columns use expression defaults (DEFAULT ('')), which requires 8.0.13+. 5.7 fails with BLOB/TEXT column can't have a default value.
Switch steps
- Create the database and grant privileges:
sql
CREATE DATABASE quickidc CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'quickidc'@'%' IDENTIFIED BY 'change-me';
GRANT ALL PRIVILEGES ON quickidc.* TO 'quickidc'@'%';
FLUSH PRIVILEGES;sql
CREATE DATABASE quickidc;
CREATE USER quickidc WITH PASSWORD 'change-me';
GRANT ALL PRIVILEGES ON DATABASE quickidc TO quickidc;- Edit
data/data.yaml:
yaml
database:
driver: postgres # or mysql
postgres:
host: 10.0.0.10
port: 5432
user: quickidc
password: change-me
database: quickidc- Restart the controller. Tables and indexes are created on first start; the startup banner reports
database: mysql|postgres.
Dialect notes
INTEGER PRIMARY KEY AUTOINCREMENTbecomesBIGINT AUTO_INCREMENT(MySQL) orBIGSERIAL(PostgreSQL).- Indexed text columns use
VARCHAR(191)on MySQL to stay withinutf8mb4index limits; JSON/large text useLONGTEXT. ON CONFLICT ... DO UPDATEbecomesON DUPLICATE KEY UPDATE;INSERT OR REPLACEbecomesREPLACE INTO.- Time-window filters are computed in Go, so no
datetime('now')is emitted. PRAGMAchecks and the log-table rebuild only run on SQLite.
Caveats
- Switching engines does not migrate existing rows. Export host config with
quickidc host exportand move instance rows with SQL tooling. - With MySQL/PostgreSQL,
data/contains onlybins/,logs/,temp/anddata.yaml. - Backups differ: SQLite
.backupor offline copy,mysqldump,pg_dump. - Validate on a staging database first: the dialect layer is covered by unit tests, but version/collation differences are still possible. Keep a rollback plan.