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
| Parameter | Type | Description |
|---|---|---|
options | { databaseUrl: string; foreignKeyOptions?: Record<string, ForeignKeyOption>; schemaPath: string; targetSchema: string; } | - |
options.databaseUrl | string | - |
options.foreignKeyOptions? | Record<string, ForeignKeyOption> | - |
options.schemaPath | string | - |
options.targetSchema | string | PG schema containing the feature's tables (e.g. "taproot"). |
Returns
Promise<void>