integrated database migrations

This commit is contained in:
2025-10-11 00:24:35 +02:00
parent 6247461754
commit 35d3ffd689
5 changed files with 18 additions and 16 deletions

View File

@@ -1,4 +0,0 @@
-- Add employee fields
ALTER TABLE users ADD COLUMN employee_type TEXT CHECK(employee_type IN ('chef', 'neuling', 'erfahren'));
ALTER TABLE users ADD COLUMN is_sufficiently_independent BOOLEAN DEFAULT FALSE;
ALTER TABLE users ADD COLUMN last_login TEXT DEFAULT NULL;

View File

@@ -1,2 +0,0 @@
-- backend/src/database/migrations/003_add_shift_name.sql
ALTER TABLE assigned_shifts ADD COLUMN name TEXT;

View File

@@ -27,11 +27,21 @@ CREATE TABLE IF NOT EXISTS shift_templates (
CREATE TABLE IF NOT EXISTS template_shifts (
id TEXT PRIMARY KEY,
template_id TEXT NOT NULL,
time_range_id TEXT NOT NULL,
day_of_week INTEGER NOT NULL CHECK (day_of_week >= 1 AND day_of_week <= 7),
required_employees INTEGER DEFAULT 1,
color TEXT DEFAULT '#3498db',
FOREIGN KEY (template_id) REFERENCES shift_templates(id) ON DELETE CASCADE,
FOREIGN KEY (time_range_id) REFERENCES template_time_slots(id) ON DELETE CASCADE
);
-- Tabelle für Zeitbereiche in den Vorlagen
CREATE TABLE IF NOT EXISTS template_time_slots (
id TEXT PRIMARY KEY,
template_id TEXT NOT NULL,
name TEXT NOT NULL,
start_time TEXT NOT NULL,
end_time TEXT NOT NULL,
required_employees INTEGER DEFAULT 1,
FOREIGN KEY (template_id) REFERENCES shift_templates(id) ON DELETE CASCADE
);