Kaizen
Browse modulesPersistenceFunctions

Function: migrateTables()

function migrateTables(options: {
  databaseUrl: string;
  foreignKeyOptions?: Record<string, ForeignKeyOption>;
  schemaPath: string;
  targetSchema: string;
}): Promise<void>;

Defined in: server/persistence/migrations.ts:54

Run Prisma migrations against the given database. Uses prisma migrate deploy under the hood — applies any pending migrations and is safe to run repeatedly.

Optionally creates foreign key constraints between taproot columns (e.g. created_by, user_id) and tables in the consumer's schema (e.g. their users table). The FK step runs after migrate deploy and is idempotent, so re-running on every deploy is safe.

Requires prisma to be installed in the consumer's project.

Parameters

ParameterTypeDescription
options{ databaseUrl: string; foreignKeyOptions?: Record<string, ForeignKeyOption>; schemaPath: string; targetSchema: string; }-
options.databaseUrlstring-
options.foreignKeyOptions?Record<string, ForeignKeyOption>-
options.schemaPathstring-
options.targetSchemastringPG schema containing the feature's tables (e.g. "taproot").

Returns

Promise<void>

On this page