Skip to content

Commit

Permalink
fix: allow multiple migration tables in same schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Bouquillon committed Mar 4, 2023
1 parent c3ada4f commit 0f42160
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 73 deletions.
73 changes: 0 additions & 73 deletions initial.sql

This file was deleted.

4 changes: 4 additions & 0 deletions src/migrate-latest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as path from "path";
import { promises as fs } from "fs";
import { Migrator, FileMigrationProvider } from "kysely";
import { db } from "./db";
import { DESTINATION_TABLE } from "./config";

async function migrateToLatest() {
const extension = await db
Expand All @@ -24,6 +25,9 @@ async function migrateToLatest() {
path,
migrationFolder: __dirname + "/migrations",
}),
// allow to have mutliple migratable instances in a single schema
migrationTableName: `${DESTINATION_TABLE}_migration`,
migrationLockTableName: `${DESTINATION_TABLE}_migration_lock`,
});

const { error, results } = await migrator.migrateToLatest();
Expand Down

0 comments on commit 0f42160

Please sign in to comment.