Update migration

This commit is contained in:
Owen
2025-09-30 13:59:12 -07:00
parent 288da0ef05
commit 089e43e1ce
2 changed files with 17 additions and 13 deletions

View File

@@ -49,6 +49,7 @@ export default async function migration() {
INSERT INTO "webauthnCredentials" ("credentialId", "publicKey", "userId", "signCount", "transports", "name", "lastUsed", "dateCreated") INSERT INTO "webauthnCredentials" ("credentialId", "publicKey", "userId", "signCount", "transports", "name", "lastUsed", "dateCreated")
VALUES (${newCredentialId}, ${newPublicKey}, ${webauthnCredential.userId}, ${webauthnCredential.signCount}, ${webauthnCredential.transports}, ${webauthnCredential.name}, ${webauthnCredential.lastUsed}, ${webauthnCredential.dateCreated}) VALUES (${newCredentialId}, ${newPublicKey}, ${webauthnCredential.userId}, ${webauthnCredential.signCount}, ${webauthnCredential.transports}, ${webauthnCredential.name}, ${webauthnCredential.lastUsed}, ${webauthnCredential.dateCreated})
`); `);
}
// 1. Add the column with placeholder so NOT NULL is satisfied // 1. Add the column with placeholder so NOT NULL is satisfied
await db.execute(sql` await db.execute(sql`
@@ -75,7 +76,8 @@ export default async function migration() {
ALTER TABLE "resources" ALTER TABLE "resources"
ADD CONSTRAINT "resources_resourceGuid_unique" UNIQUE("resourceGuid") ADD CONSTRAINT "resources_resourceGuid_unique" UNIQUE("resourceGuid")
`); `);
}
await db.execute(sql`ALTER TABLE "orgs" ADD COLUMN IF NOT EXISTS "settings" text`);
await db.execute(sql`COMMIT`); await db.execute(sql`COMMIT`);
console.log(`Updated credentialId and publicKey`); console.log(`Updated credentialId and publicKey`);

View File

@@ -82,6 +82,8 @@ export default async function migration() {
for (const row of rows) { for (const row of rows) {
updateStmt.run(randomUUID(), row.resourceId); updateStmt.run(randomUUID(), row.resourceId);
} }
db.prepare(`ALTER TABLE "orgs" ADD COLUMN IF NOT EXISTS "settings" text`).run();
})(); })();
console.log(`${version} migration complete`); console.log(`${version} migration complete`);