mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-11 05:06:39 +00:00
Add where clause to sql migrations
This commit is contained in:
@@ -18,11 +18,13 @@ export default async function migration() {
|
|||||||
const credentialId = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.credentialId, 'base64')));
|
const credentialId = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.credentialId, 'base64')));
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
UPDATE "webauthnCredentials" SET "credentialId" = ${credentialId}
|
UPDATE "webauthnCredentials" SET "credentialId" = ${credentialId}
|
||||||
|
WHERE "credentialId" = ${webauthnCredential.credentialId}
|
||||||
`);
|
`);
|
||||||
|
|
||||||
const publicKey = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.publicKey, 'base64')));
|
const publicKey = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.publicKey, 'base64')));
|
||||||
await db.execute(sql`
|
await db.execute(sql`
|
||||||
UPDATE "webauthnCredentials" SET "publicKey" = ${publicKey}
|
UPDATE "webauthnCredentials" SET "publicKey" = ${publicKey}
|
||||||
|
WHERE "credentialId" = ${webauthnCredential.credentialId}
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ export default async function migration() {
|
|||||||
for (const webauthnCredential of webauthnCredentials) {
|
for (const webauthnCredential of webauthnCredentials) {
|
||||||
const credentialId = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.credentialId, 'base64')));
|
const credentialId = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.credentialId, 'base64')));
|
||||||
db.prepare(
|
db.prepare(
|
||||||
`UPDATE 'webauthnCredentials' SET 'credentialId' = ?`
|
`UPDATE 'webauthnCredentials' SET 'credentialId' = ? WHERE 'credentialId' = ?`
|
||||||
).run(credentialId);
|
).run(credentialId, webauthnCredential.credentialId);
|
||||||
|
|
||||||
const publicKey = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.publicKey, 'base64')));
|
const publicKey = isoBase64URL.fromBuffer(new Uint8Array(Buffer.from(webauthnCredential.publicKey, 'base64')));
|
||||||
db.prepare(
|
db.prepare(
|
||||||
`UPDATE 'webauthnCredentials' SET 'publicKey' = ?`
|
`UPDATE 'webauthnCredentials' SET 'publicKey' = ? WHERE 'credentialId' = ?`
|
||||||
).run(publicKey);
|
).run(publicKey, webauthnCredential.credentialId);
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user