Speed up migrations in tests

This commit is contained in:
Alex Gleason 2024-10-18 12:24:49 -05:00
parent b876cf368a
commit 08cc4f1db9
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -57,7 +57,8 @@ export async function createTestDB(opts?: { pure?: boolean }) {
>`select tablename from pg_tables where schemaname = current_schema()`.execute(kysely); >`select tablename from pg_tables where schemaname = current_schema()`.execute(kysely);
for (const { tablename } of rows) { for (const { tablename } of rows) {
await kysely.schema.dropTable(tablename).ifExists().cascade().execute(); if (tablename.startsWith('kysely_')) continue;
await sql`truncate table ${sql.ref(tablename)} cascade`.execute(kysely);
} }
await kysely.destroy(); await kysely.destroy();