mirror of
https://github.com/fosrl/pangolin.git
synced 2025-08-01 08:34:53 +02:00
restore migrations and fix rate limit
This commit is contained in:
parent
d3383f0f1a
commit
0a97d91aed
7 changed files with 10 additions and 186 deletions
|
@ -1,39 +0,0 @@
|
|||
import { APP_PATH } from "@server/lib/consts";
|
||||
import Database from "better-sqlite3";
|
||||
import path from "path";
|
||||
|
||||
const version = "1.7.0";
|
||||
|
||||
export default async function migration() {
|
||||
console.log(`Running setup script ${version}...`);
|
||||
|
||||
const location = path.join(APP_PATH, "db", "db.sqlite");
|
||||
const db = new Database(location);
|
||||
|
||||
try {
|
||||
db.pragma("foreign_keys = OFF");
|
||||
db.transaction(() => {
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS securityKey (
|
||||
credentialId TEXT PRIMARY KEY,
|
||||
userId TEXT NOT NULL,
|
||||
publicKey TEXT NOT NULL,
|
||||
signCount INTEGER NOT NULL,
|
||||
transports TEXT,
|
||||
name TEXT,
|
||||
lastUsed TEXT NOT NULL,
|
||||
dateCreated TEXT NOT NULL,
|
||||
FOREIGN KEY (userId) REFERENCES user(id) ON DELETE CASCADE
|
||||
);
|
||||
`);
|
||||
})(); // executes the transaction immediately
|
||||
db.pragma("foreign_keys = ON");
|
||||
console.log(`Created securityKey table`);
|
||||
} catch (e) {
|
||||
console.error("Unable to create securityKey table");
|
||||
console.error(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
console.log(`${version} migration complete`);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue