mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-05 02:06:41 +00:00
Delete all before migrating
This commit is contained in:
@@ -313,6 +313,11 @@ export default async function migration() {
|
|||||||
dateCreated: string;
|
dateCreated: string;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
|
// Delete the old record
|
||||||
|
await db.execute(sql`
|
||||||
|
DELETE FROM "webauthnCredentials";
|
||||||
|
`);
|
||||||
|
|
||||||
for (const webauthnCredential of webauthnCredentials) {
|
for (const webauthnCredential of webauthnCredentials) {
|
||||||
const newCredentialId = isoBase64URL.fromBuffer(
|
const newCredentialId = isoBase64URL.fromBuffer(
|
||||||
new Uint8Array(
|
new Uint8Array(
|
||||||
@@ -325,12 +330,6 @@ export default async function migration() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Delete the old record
|
|
||||||
await db.execute(sql`
|
|
||||||
DELETE FROM "webauthnCredentials"
|
|
||||||
WHERE "credentialId" = ${webauthnCredential.credentialId}
|
|
||||||
`);
|
|
||||||
|
|
||||||
// Insert the updated record with converted values
|
// Insert the updated record with converted values
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
INSERT INTO "webauthnCredentials" ("credentialId", "publicKey", "userId", "signCount", "transports", "name", "lastUsed", "dateCreated")
|
INSERT INTO "webauthnCredentials" ("credentialId", "publicKey", "userId", "signCount", "transports", "name", "lastUsed", "dateCreated")
|
||||||
|
|||||||
@@ -269,6 +269,8 @@ export default async function migration() {
|
|||||||
dateCreated: string;
|
dateCreated: string;
|
||||||
}[];
|
}[];
|
||||||
|
|
||||||
|
db.prepare(`DELETE FROM 'webauthnCredentials';`).run();
|
||||||
|
|
||||||
for (const webauthnCredential of webauthnCredentials) {
|
for (const webauthnCredential of webauthnCredentials) {
|
||||||
const newCredentialId = isoBase64URL.fromBuffer(
|
const newCredentialId = isoBase64URL.fromBuffer(
|
||||||
new Uint8Array(
|
new Uint8Array(
|
||||||
@@ -281,11 +283,6 @@ export default async function migration() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Delete the old record
|
|
||||||
db.prepare(
|
|
||||||
`DELETE FROM 'webauthnCredentials' WHERE 'credentialId' = ?`
|
|
||||||
).run(webauthnCredential.credentialId);
|
|
||||||
|
|
||||||
// Insert the updated record with converted values
|
// Insert the updated record with converted values
|
||||||
db.prepare(
|
db.prepare(
|
||||||
`INSERT INTO 'webauthnCredentials' (credentialId, publicKey, userId, signCount, transports, name, lastUsed, dateCreated) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
`INSERT INTO 'webauthnCredentials' (credentialId, publicKey, userId, signCount, transports, name, lastUsed, dateCreated) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
|
||||||
|
|||||||
Reference in New Issue
Block a user