-- Tabelle für Ausgaben erstellen -- Diese Tabelle sollte bereits in der Docker MySQL-Datenbank existieren -- Falls nicht, hier ist das CREATE Statement: CREATE TABLE IF NOT EXISTS `Ausgaben` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `Datum` date NOT NULL, `Wo` varchar(255) DEFAULT NULL, `Was` varchar(500) DEFAULT NULL, `Wieviel` decimal(10,2) NOT NULL, `Wie` varchar(50) DEFAULT NULL, `TYP` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0=Haushalt, 1=Privat', `OK` tinyint(1) DEFAULT 0, PRIMARY KEY (`ID`), KEY `idx_datum` (`Datum`), KEY `idx_typ` (`TYP`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; -- Upgrade existing table: Add TYP column if it doesn't exist ALTER TABLE `Ausgaben` ADD COLUMN IF NOT EXISTS `TYP` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0=Haushalt, 1=Privat' AFTER `Wie`; ALTER TABLE `Ausgaben` ADD INDEX IF NOT EXISTS `idx_typ` (`TYP`); -- Remove WochTag column if it exists (no longer stored in DB, calculated from Datum) -- ALTER TABLE `Ausgaben` DROP COLUMN IF EXISTS `WochTag`;