Abwesenheiten: gemeinsamer Team-Kalender mit Sperre fuer Buchungen inkl. Vorlaufzeit
This commit is contained in:
parent
9d2154ee2d
commit
e83d6dc606
13 changed files with 533 additions and 2 deletions
26
sql/migrations/007_absences.sql
Normal file
26
sql/migrations/007_absences.sql
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
-- Abwesenheiten der Mitarbeiter (Urlaub, Krankheit, Sonstiges).
|
||||
--
|
||||
-- Eine Zeile beschreibt einen zusammenhängenden Zeitraum (start_date …
|
||||
-- end_date, jeweils inklusive). Die Liste ist für alle sichtbar; pflegen darf
|
||||
-- jeder Mitarbeiter seine eigenen Einträge, Admins alle.
|
||||
--
|
||||
-- Buchungen werden abgelehnt, wenn der zuständige Mitarbeiter im Zeitraum der
|
||||
-- Buchung inklusive Vorlauf (Erinnerung 8 Tage vor Mietbeginn) abwesend ist.
|
||||
|
||||
CREATE TABLE IF NOT EXISTS absences (
|
||||
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
employee_id BIGINT UNSIGNED NOT NULL,
|
||||
start_date DATE NOT NULL,
|
||||
end_date DATE NOT NULL,
|
||||
note VARCHAR(160) NOT NULL DEFAULT '',
|
||||
created_by BIGINT UNSIGNED NULL DEFAULT NULL,
|
||||
updated_by BIGINT UNSIGNED NULL DEFAULT NULL,
|
||||
created_at DATETIME NOT NULL,
|
||||
updated_at DATETIME NOT NULL,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_absences_employee (employee_id, start_date, end_date),
|
||||
KEY idx_absences_period (start_date, end_date),
|
||||
CONSTRAINT fk_absences_employee FOREIGN KEY (employee_id) REFERENCES employees (id) ON DELETE CASCADE,
|
||||
CONSTRAINT fk_absences_created_by FOREIGN KEY (created_by) REFERENCES users (id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_absences_updated_by FOREIGN KEY (updated_by) REFERENCES users (id) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
Loading…
Add table
Add a link
Reference in a new issue