-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Labels
configConfig relatedConfig relatedenhancementNew feature or requestNew feature or requestmigrateMigrate module relatedMigrate module related
Description
Description:
Problem:
Currently, Kysely uses a single global migration table for all schemas. In multi-schema or multi-tenant setups, this makes it difficult to manage migrations independently for each schema.
Proposed Solution:
Allow specifying a schema for the migration table, for example via a migrationSchema option in defineConfig.
Example Usage:
import { PostgresDialect } from 'kysely'
import { defineConfig } from 'kysely-ctl'
import { Pool } from 'pg'
export default defineConfig({
destroyOnExit: true,
dialect: new PostgresDialect({
pool: new Pool({
host: 'localhost',
database: 'recording',
user: 'postgres',
password: 'postgres',
port: 5432,
}),
}),
migrations: {
migrationFolder: "migrations",
migrationSchema: "tenant1", // <- proposed new option
},
})
Benefits:
Enables independent migration tracking per schema.
Avoids conflicts when multiple schemas evolve differently.
Makes multi-tenant or modular database setups easier to manage.
Additional Context:
This is similar to how some ORMs allow schema-specific migration tables, which is very useful for projects with multiple tenants or schema-per-module setups.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
configConfig relatedConfig relatedenhancementNew feature or requestNew feature or requestmigrateMigrate module relatedMigrate module related