diff --git a/package.json b/package.json index e2da86c..0fc16a9 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "type": "module", "dependencies": { "@fontsource/fira-mono": "^4.5.0", + "@types/better-sqlite3": "^7.6.1", "better-sqlite3": "^7.6.2", "cookie": "^0.5.0", "html2canvas": "^1.4.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7456e71..e9ad3de 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,7 @@ specifiers: '@sveltejs/adapter-auto': next '@sveltejs/adapter-node': 1.0.0-next.95 '@sveltejs/kit': next + '@types/better-sqlite3': ^7.6.1 '@types/cookie': ^0.5.1 better-sqlite3: ^7.6.2 cookie: ^0.5.0 @@ -19,6 +20,7 @@ specifiers: dependencies: '@fontsource/fira-mono': 4.5.9 + '@types/better-sqlite3': 7.6.1 better-sqlite3: 7.6.2 cookie: 0.5.0 html2canvas: 1.4.1 @@ -284,6 +286,12 @@ packages: - supports-color dev: true + /@types/better-sqlite3/7.6.1: + resolution: {integrity: sha512-2MuzBUSwAjY8GoT04vcLUojHmuuOCEFboESZfx6u9gpnHym5mYBMhCKGoe+R+yXkiho1xg348LRH8x27cJLHjw==} + dependencies: + '@types/node': 18.7.18 + dev: false + /@types/cookie/0.5.1: resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==} dev: true @@ -298,7 +306,6 @@ packages: /@types/node/18.7.18: resolution: {integrity: sha512-m+6nTEOadJZuTPkKR/SYK3A2d7FZrgElol9UP1Kae90VVU4a6mxnPuLiIW1m4Cq4gZ/nWb9GrdVXJCoCazDAbg==} - dev: true /@types/pug/2.0.6: resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==} diff --git a/src/lib/db/db.js b/src/lib/db/db.js index 2e5f6bf..fa7d436 100644 --- a/src/lib/db/db.js +++ b/src/lib/db/db.js @@ -1,4 +1,7 @@ +/** @typedef {typeof import('better-sqlite3')} better-sqlite3 */ import Database from 'better-sqlite3'; -const db = new Database('./carteles_dev.sqlite', { verbose: console.log }) -db.pragma +export const db = new Database('./carteles_dev.sqlite', { verbose: console.log }) +db.pragma("journal_mode = WAL"); +db.pragma("synchronous = normal"); +db.pragma("temp_store = memory");