feat: add IF NOT EXISTS to migrations, add courses nav item, lock playwright deps

This commit is contained in:
2026-04-29 04:38:20 +02:00
parent 7a0f6aa0a7
commit bbcdbf957e
3 changed files with 56 additions and 17 deletions

View File

@@ -1,35 +1,35 @@
CREATE TABLE courses (
CREATE TABLE IF NOT EXISTS courses (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
semester TEXT NOT NULL
);
CREATE TABLE tutors (
CREATE TABLE IF NOT EXISTS tutors (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL,
password_hash TEXT NOT NULL
);
CREATE TABLE tutor_courses (
CREATE TABLE IF NOT EXISTS tutor_courses (
tutor_id INTEGER NOT NULL REFERENCES tutors(id),
course_id INTEGER NOT NULL REFERENCES courses(id),
PRIMARY KEY (tutor_id, course_id)
);
CREATE TABLE students (
CREATE TABLE IF NOT EXISTS students (
id INTEGER PRIMARY KEY,
course_id INTEGER NOT NULL REFERENCES courses(id),
name TEXT NOT NULL
);
CREATE TABLE rooms (
CREATE TABLE IF NOT EXISTS rooms (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
layout_json TEXT NOT NULL
);
CREATE TABLE sessions (
CREATE TABLE IF NOT EXISTS sessions (
id INTEGER PRIMARY KEY,
course_id INTEGER NOT NULL REFERENCES courses(id),
week_nr INTEGER NOT NULL,
@@ -37,7 +37,7 @@ CREATE TABLE sessions (
UNIQUE(course_id, week_nr)
);
CREATE TABLE slots (
CREATE TABLE IF NOT EXISTS slots (
id INTEGER PRIMARY KEY,
session_id INTEGER NOT NULL REFERENCES sessions(id),
room_id INTEGER REFERENCES rooms(id),
@@ -48,7 +48,7 @@ CREATE TABLE slots (
code TEXT UNIQUE
);
CREATE TABLE attendances (
CREATE TABLE IF NOT EXISTS attendances (
id INTEGER PRIMARY KEY,
slot_id INTEGER NOT NULL REFERENCES slots(id),
student_id INTEGER NOT NULL REFERENCES students(id),
@@ -58,7 +58,7 @@ CREATE TABLE attendances (
UNIQUE(slot_id, seat_id)
);
CREATE TABLE notes (
CREATE TABLE IF NOT EXISTS notes (
id INTEGER PRIMARY KEY,
slot_id INTEGER NOT NULL REFERENCES slots(id),
student_id INTEGER NOT NULL REFERENCES students(id),
@@ -69,11 +69,11 @@ CREATE TABLE notes (
);
-- Indexes on high-frequency FK columns (SQLite does not auto-index FKs)
CREATE INDEX idx_students_course ON students(course_id);
CREATE INDEX idx_sessions_course ON sessions(course_id);
CREATE INDEX idx_slots_session ON slots(session_id);
CREATE INDEX idx_slots_tutor ON slots(tutor_id);
CREATE INDEX idx_attendances_slot ON attendances(slot_id);
CREATE INDEX idx_attendances_student ON attendances(student_id);
CREATE INDEX idx_notes_slot ON notes(slot_id);
CREATE INDEX idx_notes_student ON notes(student_id);
CREATE INDEX IF NOT EXISTS idx_students_course ON students(course_id);
CREATE INDEX IF NOT EXISTS idx_sessions_course ON sessions(course_id);
CREATE INDEX IF NOT EXISTS idx_slots_session ON slots(session_id);
CREATE INDEX IF NOT EXISTS idx_slots_tutor ON slots(tutor_id);
CREATE INDEX IF NOT EXISTS idx_attendances_slot ON attendances(slot_id);
CREATE INDEX IF NOT EXISTS idx_attendances_student ON attendances(student_id);
CREATE INDEX IF NOT EXISTS idx_notes_slot ON notes(slot_id);
CREATE INDEX IF NOT EXISTS idx_notes_student ON notes(student_id);

View File

@@ -8,6 +8,9 @@ importers:
.:
devDependencies:
'@playwright/test':
specifier: ^1.59.1
version: 1.59.1
'@sveltejs/adapter-static':
specifier: latest
version: 3.0.10(@sveltejs/kit@2.58.0(@sveltejs/vite-plugin-svelte@7.0.0(svelte@5.55.5)(vite@8.0.10))(svelte@5.55.5)(typescript@6.0.3)(vite@8.0.10))
@@ -69,6 +72,11 @@ packages:
'@oxc-project/types@0.127.0':
resolution: {integrity: sha512-aIYXQBo4lCbO4z0R3FHeucQHpF46l2LbMdxRvqvuRuW2OxdnSkcng5B8+K12spgLDj93rtN3+J2Vac/TIO+ciQ==}
'@playwright/test@1.59.1':
resolution: {integrity: sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg==}
engines: {node: '>=18'}
hasBin: true
'@polka/url@1.0.0-next.29':
resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==}
@@ -321,6 +329,11 @@ packages:
picomatch:
optional: true
fsevents@2.3.2:
resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
os: [darwin]
fsevents@2.3.3:
resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@@ -436,6 +449,16 @@ packages:
resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==}
engines: {node: '>=12'}
playwright-core@1.59.1:
resolution: {integrity: sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==}
engines: {node: '>=18'}
hasBin: true
playwright@1.59.1:
resolution: {integrity: sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==}
engines: {node: '>=18'}
hasBin: true
postcss@8.5.12:
resolution: {integrity: sha512-W62t/Se6rA0Az3DfCL0AqJwXuKwBeYg6nOaIgzP+xZ7N5BFCI7DYi1qs6ygUYT6rvfi6t9k65UMLJC+PHZpDAA==}
engines: {node: ^10 || ^12 || >=14}
@@ -592,6 +615,10 @@ snapshots:
'@oxc-project/types@0.127.0': {}
'@playwright/test@1.59.1':
dependencies:
playwright: 1.59.1
'@polka/url@1.0.0-next.29': {}
'@rolldown/binding-android-arm64@1.0.0-rc.17':
@@ -756,6 +783,9 @@ snapshots:
optionalDependencies:
picomatch: 4.0.4
fsevents@2.3.2:
optional: true
fsevents@2.3.3:
optional: true
@@ -832,6 +862,14 @@ snapshots:
picomatch@4.0.4: {}
playwright-core@1.59.1: {}
playwright@1.59.1:
dependencies:
playwright-core: 1.59.1
optionalDependencies:
fsevents: 2.3.2
postcss@8.5.12:
dependencies:
nanoid: 3.3.11

View File

@@ -22,6 +22,7 @@
const navItems = [
{ id: 'dashboard', label: 'Dashboard', href: '/admin' },
{ id: 'courses', label: 'Kurse', href: '/admin/courses', superadmin: true },
{ id: 'live', label: 'Live · Sitzplan', href: '/admin/sessions' },
{ id: 'attendance', label: 'Anwesenheit', href: '/admin/attendance' },
{ id: 'rooms', label: 'Räume', href: '/admin/rooms' },