mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
moved pragma statements in initializedatabase
This commit is contained in:
@@ -37,6 +37,19 @@ export async function initializeDatabase(): Promise<void> {
|
|||||||
try {
|
try {
|
||||||
console.log('Starting database initialization...');
|
console.log('Starting database initialization...');
|
||||||
|
|
||||||
|
// ✅ Set PRAGMA statements FIRST, before any transactions
|
||||||
|
await db.run('PRAGMA journal_mode = WAL;');
|
||||||
|
await db.run('PRAGMA synchronous = NORMAL;');
|
||||||
|
await db.run('PRAGMA foreign_keys = ON;');
|
||||||
|
await db.run('PRAGMA secure_delete = ON;');
|
||||||
|
await db.run('PRAGMA auto_vacuum = INCREMENTAL;');
|
||||||
|
|
||||||
|
|
||||||
|
// ❌ REMOVE this line - synchronous cannot be changed in transaction
|
||||||
|
// await db.run('PRAGMA synchronous = NORMAL;');
|
||||||
|
|
||||||
|
console.log('✅ Database PRAGMA settings configured');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const existingAdmin = await db.get<{ count: number }>(
|
const existingAdmin = await db.get<{ count: number }>(
|
||||||
`SELECT COUNT(*) as count
|
`SELECT COUNT(*) as count
|
||||||
|
|||||||
Reference in New Issue
Block a user