mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
moved pragma statements into schema.sql
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
PRAGMA journal_mode = WAL;
|
||||||
|
PRAGMA foreign_keys = ON;
|
||||||
|
PRAGMA secure_delete = ON;
|
||||||
|
PRAGMA auto_vacuum = INCREMENTAL;
|
||||||
|
|
||||||
-- Employee Types
|
-- Employee Types
|
||||||
CREATE TABLE IF NOT EXISTS employee_types (
|
CREATE TABLE IF NOT EXISTS employee_types (
|
||||||
type TEXT PRIMARY KEY,
|
type TEXT PRIMARY KEY,
|
||||||
@@ -149,9 +154,3 @@ CREATE INDEX IF NOT EXISTS idx_scheduled_shifts_required_employees ON scheduled_
|
|||||||
CREATE INDEX IF NOT EXISTS idx_shift_assignments_employee ON shift_assignments(employee_id);
|
CREATE INDEX IF NOT EXISTS idx_shift_assignments_employee ON shift_assignments(employee_id);
|
||||||
CREATE INDEX IF NOT EXISTS idx_shift_assignments_shift ON shift_assignments(scheduled_shift_id);
|
CREATE INDEX IF NOT EXISTS idx_shift_assignments_shift ON shift_assignments(scheduled_shift_id);
|
||||||
CREATE INDEX IF NOT EXISTS idx_employee_availability_employee_plan ON employee_availability(employee_id, plan_id);
|
CREATE INDEX IF NOT EXISTS idx_employee_availability_employee_plan ON employee_availability(employee_id, plan_id);
|
||||||
|
|
||||||
PRAGMA journal_mode = WAL;
|
|
||||||
PRAGMA synchronous = NORMAL;
|
|
||||||
PRAGMA foreign_keys = ON;
|
|
||||||
PRAGMA secure_delete = ON;
|
|
||||||
PRAGMA auto_vacuum = INCREMENTAL;
|
|
||||||
@@ -37,19 +37,6 @@ 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
|
||||||
|
|||||||
3828
package-lock.json
generated
Normal file
3828
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user