<?php
return [
    'description' => 'Initial schema',
    'up' => [
        "CREATE TABLE IF NOT EXISTS users (
            id            INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            username      VARCHAR(255) NOT NULL UNIQUE,
            name          VARCHAR(255) NOT NULL,
            role          VARCHAR(32)  NOT NULL DEFAULT 'user',
            password_hash VARCHAR(255) NOT NULL,
            active        TINYINT(1)   NOT NULL DEFAULT 1,
            created_at    VARCHAR(32)  NOT NULL,
            email         VARCHAR(255) NOT NULL DEFAULT '',
            telefon       VARCHAR(64)  NOT NULL DEFAULT ''
        )",
        "CREATE TABLE IF NOT EXISTS requests_urlaubsantrag (
            id         INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id    INT          NOT NULL,
            status     VARCHAR(16)  NOT NULL DEFAULT 'pending',
            admin_note TEXT         NOT NULL,
            created_at VARCHAR(32)  NOT NULL,
            updated_at VARCHAR(32)  NOT NULL,
            von        VARCHAR(32)  NOT NULL DEFAULT '',
            bis        VARCHAR(32)  NOT NULL DEFAULT '',
            vertretung VARCHAR(255) NOT NULL DEFAULT '',
            nachricht  TEXT         NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS requests_abwesenheitsantrag (
            id         INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id    INT          NOT NULL,
            status     VARCHAR(16)  NOT NULL DEFAULT 'pending',
            admin_note TEXT         NOT NULL,
            created_at VARCHAR(32)  NOT NULL,
            updated_at VARCHAR(32)  NOT NULL,
            von        VARCHAR(32)  NOT NULL DEFAULT '',
            bis        VARCHAR(32)  NOT NULL DEFAULT '',
            grund      VARCHAR(64)  NOT NULL DEFAULT '',
            vertretung VARCHAR(255) NOT NULL DEFAULT '',
            nachricht  TEXT         NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS requests_benefitsantrag (
            id         INT         NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id    INT         NOT NULL,
            status     VARCHAR(16) NOT NULL DEFAULT 'pending',
            admin_note TEXT        NOT NULL,
            created_at VARCHAR(32) NOT NULL,
            updated_at VARCHAR(32) NOT NULL,
            benefit    VARCHAR(64) NOT NULL DEFAULT '',
            nachricht  TEXT        NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS requests_werben (
            id            INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id       INT          NOT NULL,
            status        VARCHAR(16)  NOT NULL DEFAULT 'pending',
            admin_note    TEXT         NOT NULL,
            created_at    VARCHAR(32)  NOT NULL,
            updated_at    VARCHAR(32)  NOT NULL,
            name          VARCHAR(255) NOT NULL DEFAULT '',
            email         VARCHAR(255) NOT NULL DEFAULT '',
            qualifikation VARCHAR(64)  NOT NULL DEFAULT '',
            nachricht     TEXT         NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS dienstplan (
            id         INT         NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id    INT         NOT NULL,
            date       VARCHAR(16) NOT NULL,
            schicht    VARCHAR(16) NOT NULL,
            created_at VARCHAR(32) NOT NULL,
            updated_at VARCHAR(32) NOT NULL,
            UNIQUE KEY uq_user_date (user_id, date)
        )",
        "CREATE TABLE IF NOT EXISTS downloads (
            id            INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            title         VARCHAR(255) NOT NULL,
            description   TEXT         NOT NULL,
            filename      VARCHAR(255) NOT NULL,
            original_name VARCHAR(255) NOT NULL,
            sort_order    INT          NOT NULL DEFAULT 0,
            created_at    VARCHAR(32)  NOT NULL,
            updated_at    VARCHAR(32)  NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS fortbildung_materials (
            id            INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            title         VARCHAR(255) NOT NULL,
            description   TEXT         NOT NULL,
            filename      VARCHAR(255) NOT NULL,
            original_name VARCHAR(255) NOT NULL,
            sort_order    INT          NOT NULL DEFAULT 0,
            created_at    VARCHAR(32)  NOT NULL,
            updated_at    VARCHAR(32)  NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS requests_fortbildungsantrag (
            id            INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id       INT          NOT NULL,
            status        VARCHAR(16)  NOT NULL DEFAULT 'pending',
            admin_note    TEXT         NOT NULL,
            anliegen      TEXT         NOT NULL,
            thema         TEXT         NOT NULL,
            nachricht     TEXT         NOT NULL,
            filename      VARCHAR(255) NOT NULL DEFAULT '',
            original_name VARCHAR(255) NOT NULL DEFAULT '',
            created_at    VARCHAR(32)  NOT NULL,
            updated_at    VARCHAR(32)  NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS requests_stundennachweis (
            id            INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id       INT          NOT NULL,
            status        VARCHAR(16)  NOT NULL DEFAULT 'pending',
            admin_note    TEXT         NOT NULL,
            monat         VARCHAR(16)  NOT NULL,
            filename      VARCHAR(255) NOT NULL DEFAULT '',
            original_name VARCHAR(255) NOT NULL DEFAULT '',
            created_at    VARCHAR(32)  NOT NULL,
            updated_at    VARCHAR(32)  NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS einsatzbewertungen (
            id         INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id    INT          NOT NULL,
            einsatzort VARCHAR(255) NOT NULL,
            von        VARCHAR(32)  NOT NULL,
            bis        VARCHAR(32)  NOT NULL,
            bewertung  TINYINT      NOT NULL,
            wieder     TINYINT(1)   NOT NULL DEFAULT 0,
            feedback   TEXT         NOT NULL,
            created_at VARCHAR(32)  NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS dokumente (
            id            INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            user_id       INT          NOT NULL,
            kategorie     VARCHAR(255) NOT NULL DEFAULT 'Sonstiges',
            beschreibung  TEXT         NOT NULL,
            filename      VARCHAR(255) NOT NULL,
            original_name VARCHAR(255) NOT NULL,
            filesize      INT          NOT NULL DEFAULT 0,
            created_at    VARCHAR(32)  NOT NULL
        )",
        "CREATE TABLE IF NOT EXISTS news (
            id         INT          NOT NULL AUTO_INCREMENT PRIMARY KEY,
            title      VARCHAR(255) NOT NULL,
            text       TEXT         NOT NULL,
            date       VARCHAR(16)  NOT NULL,
            created_at VARCHAR(32)  NOT NULL
        )",
    ],
];
