File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ mission-control/
106106│ ├── lib/
107107│ │ ├── auth.ts # Session + API key auth, RBAC
108108│ │ ├── db.ts # SQLite (better-sqlite3, WAL mode)
109- │ │ ├── migrations.ts # 14 schema migrations
109+ │ │ ├── migrations.ts # 15 schema migrations
110110│ │ ├── scheduler.ts # Background task scheduler
111111│ │ ├── webhooks.ts # Outbound webhook delivery
112112│ │ └── websocket.ts # Gateway WebSocket client
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ export function getDatabase(): Database.Database {
2323 db . pragma ( 'journal_mode = WAL' ) ;
2424 db . pragma ( 'synchronous = NORMAL' ) ;
2525 db . pragma ( 'cache_size = 1000' ) ;
26+ db . pragma ( 'foreign_keys = ON' ) ;
2627
2728 // Initialize schema if needed
2829 initializeSchema ( ) ;
Original file line number Diff line number Diff line change @@ -424,6 +424,18 @@ const migrations: Migration[] = [
424424 db . exec ( `CREATE INDEX IF NOT EXISTS idx_users_provider ON users(provider)` )
425425 db . exec ( `CREATE INDEX IF NOT EXISTS idx_users_email ON users(email)` )
426426 }
427+ } ,
428+ {
429+ id : '015_missing_indexes' ,
430+ up : ( db ) => {
431+ db . exec ( `
432+ CREATE INDEX IF NOT EXISTS idx_notifications_read_at ON notifications(read_at);
433+ CREATE INDEX IF NOT EXISTS idx_notifications_recipient_read ON notifications(recipient, read_at);
434+ CREATE INDEX IF NOT EXISTS idx_activities_actor ON activities(actor);
435+ CREATE INDEX IF NOT EXISTS idx_activities_entity ON activities(entity_type, entity_id);
436+ CREATE INDEX IF NOT EXISTS idx_messages_read_at ON messages(read_at);
437+ ` )
438+ }
427439 }
428440]
429441
You can’t perform that action at this time.
0 commit comments