wip(TRUEREF-0018): commit version-scoped indexing work
This commit is contained in:
@@ -23,17 +23,34 @@ function createTestDb(): Database.Database {
|
||||
client.pragma('foreign_keys = ON');
|
||||
|
||||
const migrationsFolder = join(import.meta.dirname, '../db/migrations');
|
||||
const migrationSql = readFileSync(
|
||||
|
||||
// Apply all migration files in order
|
||||
const migration0 = readFileSync(
|
||||
join(migrationsFolder, '0000_large_master_chief.sql'),
|
||||
'utf-8'
|
||||
);
|
||||
const migration1 = readFileSync(
|
||||
join(migrationsFolder, '0001_quick_nighthawk.sql'),
|
||||
'utf-8'
|
||||
);
|
||||
|
||||
const statements = migrationSql
|
||||
// Apply first migration
|
||||
const statements0 = migration0
|
||||
.split('--> statement-breakpoint')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
for (const stmt of statements) {
|
||||
for (const stmt of statements0) {
|
||||
client.exec(stmt);
|
||||
}
|
||||
|
||||
// Apply second migration
|
||||
const statements1 = migration1
|
||||
.split('--> statement-breakpoint')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
for (const stmt of statements1) {
|
||||
client.exec(stmt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user