fix: serialize editorial approval delivery
This commit is contained in:
1 parent
3584b4a7a7
commit
3f84b840d9
6 files changed
+215
-57
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { readdir, readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
|
||||
import { PostgreSqlContainer, type StartedPostgreSqlContainer } from "@testcontainers/postgresql";
|
||||
@@ -53,8 +53,13 @@ export async function startPostgres(): Promise<PostgresTestDatabase> {
|
||||
}
|
||||
|
||||
async function applyMigration(pool: Pool) {
|
||||
const migration = await readFile(path.join(process.cwd(), "drizzle/0000_initial.sql"), "utf8");
|
||||
await pool.query(migration);
|
||||
const migrationDirectory = path.join(process.cwd(), "drizzle");
|
||||
const migrationFiles = (await readdir(migrationDirectory))
|
||||
.filter((file) => /^\d+_.*\.sql$/.test(file))
|
||||
.sort();
|
||||
for (const file of migrationFiles) {
|
||||
await pool.query(await readFile(path.join(migrationDirectory, file), "utf8"));
|
||||
}
|
||||
}
|
||||
|
||||
async function seedEditorialWithUsage(db: NodePgDatabase<typeof schema>): Promise<DownloadSeed> {
|
||||
|
||||
Reference in new issue
Block a user