Files
ressourcenplanung/server/schema.sql
T
admin fc25eff643 Initial commit: Ressourcenplanung-App
Vue 3 + Vite Frontend und Node/Express + SQLite Backend für
Projekt-, Aufgaben-, Mitarbeiter- und Teamverwaltung inkl.
Gantt-Zeitplan und Auslastungs-Heatmap.
2026-07-03 22:45:07 +02:00

55 lines
1.6 KiB
SQL

PRAGMA foreign_keys = ON;
CREATE TABLE IF NOT EXISTS employees (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT,
role TEXT,
weekly_capacity_hours REAL NOT NULL DEFAULT 40
);
CREATE TABLE IF NOT EXISTS teams (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
description TEXT
);
CREATE TABLE IF NOT EXISTS team_members (
team_id INTEGER NOT NULL REFERENCES teams(id) ON DELETE CASCADE,
employee_id INTEGER NOT NULL REFERENCES employees(id) ON DELETE CASCADE,
PRIMARY KEY (team_id, employee_id)
);
CREATE TABLE IF NOT EXISTS projects (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
description TEXT,
start_date TEXT,
end_date TEXT,
color TEXT DEFAULT '#4f46e5'
);
CREATE TABLE IF NOT EXISTS tasks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
project_id INTEGER NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
name TEXT NOT NULL,
start_date TEXT NOT NULL,
end_date TEXT NOT NULL,
estimated_hours REAL NOT NULL DEFAULT 0,
status TEXT NOT NULL DEFAULT 'geplant'
);
CREATE TABLE IF NOT EXISTS task_dependencies (
task_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
depends_on_task_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
PRIMARY KEY (task_id, depends_on_task_id)
);
CREATE TABLE IF NOT EXISTS assignments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
task_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
employee_id INTEGER NOT NULL REFERENCES employees(id) ON DELETE CASCADE,
allocated_hours_per_week REAL NOT NULL DEFAULT 0,
UNIQUE (task_id, employee_id)
);