refactor: migrate legacy wire namespace to wrn
This commit is contained in:
@@ -105,7 +105,7 @@ for (const [label, driver] of [
|
||||
}
|
||||
|
||||
test("migration runner: parse, migrate, status, rollback", async () => {
|
||||
const dir = mkdtempSync(join(tmpdir(), "wire-mig-"));
|
||||
const dir = mkdtempSync(join(tmpdir(), "wrn-mig-"));
|
||||
writeFileSync(
|
||||
join(dir, "0001_init.sql"),
|
||||
"-- +up\nCREATE TABLE t (id INTEGER PRIMARY KEY, n TEXT);\n-- +down\nDROP TABLE t;",
|
||||
@@ -166,15 +166,15 @@ test("migration lock rejects a concurrent runner and recovers expired locks", as
|
||||
const db = createDb(sqlite());
|
||||
const migrations = [{ name: "0001_lock", up: "CREATE TABLE locked_test (id INTEGER)", down: "" }];
|
||||
await db.exec(
|
||||
"CREATE TABLE _wire_migration_locks (name TEXT PRIMARY KEY, owner TEXT NOT NULL, expires_at TEXT NOT NULL)",
|
||||
"CREATE TABLE _wrn_migration_locks (name TEXT PRIMARY KEY, owner TEXT NOT NULL, expires_at TEXT NOT NULL)",
|
||||
);
|
||||
await db.exec("INSERT INTO _wire_migration_locks (name, owner, expires_at) VALUES (?, ?, ?)", [
|
||||
await db.exec("INSERT INTO _wrn_migration_locks (name, owner, expires_at) VALUES (?, ?, ?)", [
|
||||
"global",
|
||||
"other",
|
||||
new Date(Date.now() + 60_000).toISOString(),
|
||||
]);
|
||||
await expect(applyMigrations(db, migrations)).rejects.toThrow("WRN-DB-MIGRATION-LOCKED");
|
||||
await db.exec("UPDATE _wire_migration_locks SET expires_at = ?", [new Date(0).toISOString()]);
|
||||
await db.exec("UPDATE _wrn_migration_locks SET expires_at = ?", [new Date(0).toISOString()]);
|
||||
expect(await applyMigrations(db, migrations)).toEqual(["0001_lock"]);
|
||||
await db.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user