Files
klarbild/migrations/007_delivery_targets.sql
T

22 lines
876 B
SQL

-- Mehrere Auslieferungsziele (FTP/SFTP-Quellen), z. B. eine zweite Picdrop-Galerie
-- oder ein anderer FTP-Server. Rezepte/Presets können ein Ziel fest verdrahten.
CREATE TABLE IF NOT EXISTS delivery_targets (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
name text NOT NULL,
protocol text CHECK (protocol IN ('ftps','sftp')),
host text,
port int,
username text,
password_enc text,
base_path text,
created_at timestamptz NOT NULL DEFAULT now()
);
-- Preset → festes Ziel (NULL = Standard-Picdrop aus den Einstellungen).
ALTER TABLE recipes ADD COLUMN IF NOT EXISTS delivery_target_id uuid
REFERENCES delivery_targets(id) ON DELETE SET NULL;
-- Ordner → festes Ziel (optional).
ALTER TABLE folders ADD COLUMN IF NOT EXISTS delivery_target_id uuid
REFERENCES delivery_targets(id) ON DELETE SET NULL;