| 12345678910111213141516171819202122 |
- /**
- * Force-initialize the SQLite database.
- *
- * Creates the data directory and database file (if they don't exist),
- * runs schema initialization (users table), and seeds the admin user
- * (admin@delete.me / deleteme) if the users table is empty.
- *
- * Idempotent — safe to run multiple times.
- * Requires config.json at the project root (copy from config.json.example).
- */
- import { getSqlite3, closeSqlite3 } from '../src/lib/sqlite3/database.js';
- try {
- const db = await getSqlite3();
- console.log('Database initialized successfully');
- closeSqlite3();
- process.exit(0);
- } catch (err) {
- console.error('Database initialization failed:', err.message);
- process.exit(1);
- }
|