22 lines
966 B
SQL
22 lines
966 B
SQL
-- Bereinigt die noch aus der Zeit vor Fix #116 stammenden, webroot-relativen
|
|
-- Pfad-Präfixe "static/uploads/". Belegdateien und Logo liegen seither außerhalb
|
|
-- des Web-Roots (data/belege bzw. data/logo); die DB speichert nur noch den
|
|
-- Pfad relativ zum jeweiligen Datenverzeichnis.
|
|
--
|
|
-- Idempotent: Der WHERE-Filter greift nach dem ersten Lauf nicht mehr.
|
|
-- LENGTH('static/uploads/') = 15, SUBSTRING ist 1-basiert -> ab Position 16.
|
|
|
|
UPDATE belege
|
|
SET storage_path = SUBSTRING(storage_path, 16)
|
|
WHERE storage_path LIKE 'static/uploads/%';
|
|
|
|
-- Das Logo lag zusätzlich in einem eigenen Unterordner "logo/", der beim Umzug
|
|
-- zum eigenen Datenverzeichnis data/logo wurde -> auch dieses Präfix entfernen.
|
|
-- LENGTH('logo/') = 5 -> ab Position 6.
|
|
UPDATE company_settings
|
|
SET logo_path = SUBSTRING(logo_path, 16)
|
|
WHERE logo_path LIKE 'static/uploads/%';
|
|
|
|
UPDATE company_settings
|
|
SET logo_path = SUBSTRING(logo_path, 6)
|
|
WHERE logo_path LIKE 'logo/%';
|