Weiter gebaut
Some checks failed
Host-Based Deploy (Java 21 Fix) / build-and-run (push) Has been cancelled
Some checks failed
Host-Based Deploy (Java 21 Fix) / build-and-run (push) Has been cancelled
This commit is contained in:
8
bin/main/db/migration/V1__baseline.sql
Normal file
8
bin/main/db/migration/V1__baseline.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- Baseline marker für Flyway.
|
||||
-- Diese Migration wird auf bestehenden Datenbanken nicht ausgeführt
|
||||
-- (spring.flyway.baseline-on-migrate=true markiert sie als bereits angewendet).
|
||||
-- Für neue Datenbanken: Schema wird von Hibernate (ddl-auto=update) angelegt,
|
||||
-- da kein vollständiges CREATE-Skript vorhanden ist.
|
||||
-- Sobald das Schema stabil ist, diesen Inhalt durch ein vollständiges
|
||||
-- mysqldump --no-data xxx_sphere > V1__baseline.sql ersetzen
|
||||
-- und ddl-auto auf validate umstellen.
|
||||
34
bin/main/db/migration/V2__available_in.sql
Normal file
34
bin/main/db/migration/V2__available_in.sql
Normal file
@@ -0,0 +1,34 @@
|
||||
-- Migration: vanillaAvailable (boolean) → availableIn (VARCHAR enum)
|
||||
--
|
||||
-- BDSM_AND_VANILLA = ehemals vanilla_available = TRUE
|
||||
-- BDSM_ONLY = ehemals vanilla_available = FALSE (Default)
|
||||
-- CHASTITY_ONLY = neuer Wert
|
||||
--
|
||||
-- Die Prozedur prüft zuerst, ob vanilla_available noch existiert, bevor
|
||||
-- sie etwas tut – dadurch ist die Migration auf leeren Datenbanken ein No-op.
|
||||
|
||||
DROP PROCEDURE IF EXISTS proc_migrate_available_in;
|
||||
|
||||
CREATE PROCEDURE proc_migrate_available_in()
|
||||
BEGIN
|
||||
DECLARE col_exists INT DEFAULT 0;
|
||||
SELECT COUNT(*) INTO col_exists
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'aufgaben_gruppe'
|
||||
AND COLUMN_NAME = 'vanilla_available';
|
||||
|
||||
IF col_exists > 0 THEN
|
||||
ALTER TABLE aufgaben_gruppe
|
||||
ADD COLUMN available_in VARCHAR(50) NOT NULL DEFAULT 'BDSM_ONLY';
|
||||
UPDATE aufgaben_gruppe
|
||||
SET available_in = 'BDSM_AND_VANILLA'
|
||||
WHERE vanilla_available = 1;
|
||||
ALTER TABLE aufgaben_gruppe
|
||||
DROP COLUMN vanilla_available;
|
||||
END IF;
|
||||
END;
|
||||
|
||||
CALL proc_migrate_available_in();
|
||||
|
||||
DROP PROCEDURE IF EXISTS proc_migrate_available_in;
|
||||
Reference in New Issue
Block a user