Spaces:
Sleeping
Sleeping
Download server/db/database.js from umaine/COS498-Group7: direct link, hf CLI and curl.
- Browser
- Download file 488 Bytes
-
https://huggingface.co/spaces/umaine/COS498-Group7/resolve/main/server/db/database.js
- Command line
-
hf download hf://spaces/umaine/COS498-Group7/server/db/database.js
-
curl -L -o database.js https://huggingface.co/spaces/umaine/COS498-Group7/resolve/main/server/db/database.js
488 Bytes
| const Database = require('better-sqlite3'); | |
| const path = require('path'); | |
| const fs = require('fs'); | |
| const DB_PATH = path.join(__dirname, 'pcpal.db'); | |
| const SCHEMA_PATH = path.join(__dirname, 'schema.sql'); | |
| const db = new Database(DB_PATH); | |
| // Enable WAL mode for better performance | |
| db.pragma('journal_mode = WAL'); | |
| db.pragma('foreign_keys = ON'); | |
| // Read and execute schema on initialization | |
| const schema = fs.readFileSync(SCHEMA_PATH, 'utf8'); | |
| db.exec(schema); | |
| module.exports = db; | |