Skip to main content

Configuration

Default configuration keys for @quik/database. See Config Keys and Environment Variables for the full generated table.

  • db.configuration selects the active connection (mysql, postgres, or sqlite); leave it empty to run without a database connection.
  • db.mysql.*, db.postgres.*, db.sqlite.* hold the per-dialect connection settings for each supported engine.
  • db.logging / db.debug enable Knex query logging and debug output.
  • db.migrations.enabled and db.migrations.table control whether the migration engine runs and which table tracks applied migrations.
  • db.migrations.snapshotFile (default ./migrations/.schema-snapshot.json) is the schema snapshot migration:generate diffs registered models against; commit this file, it's the diff baseline for the next run.

Postgres schema support​

@Model()/@BaseModel() accept an optional schema field (Postgres only) that qualifies the resolved table name, e.g. @Model({ name: "BuilderModule", schema: "builder" }) resolves to table builder.BuilderModule. This is not a db.* config key — it is set per model. Migrations for a schema-scoped module must be scoped with MigrationStore.setSchema(module, schema); the engine then issues CREATE SCHEMA IF NOT EXISTS against Postgres before running that module's migrations. Schema scoping throws QMigrationError on any dialect other than Postgres.

Migrations table upgrades​

The migrations bookkeeping table is upgraded automatically: missing columns (executedAt, batchId, checksum, schema, ...) are added additively the first time the migration engine resolves the table, so upgrading the framework does not require a manual step for the table to pick up new metadata columns. Run the migration:update-table CLI command manually only when you want to force a checksum refresh ahead of time.