This commit is contained in:
2026-08-22 02:59:16 +02:00
commit 6a5bb1d699
100 changed files with 17409 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
CREATE TABLE IF NOT EXISTS gifts (
id TEXT PRIMARY KEY NOT NULL,
slug TEXT NOT NULL UNIQUE,
recipient_name TEXT NOT NULL,
sender_name TEXT NOT NULL,
title TEXT NOT NULL,
intro_message TEXT NOT NULL,
reveal_message TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'published',
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT gifts_status_check CHECK (status IN ('draft', 'published', 'archived'))
);
CREATE TABLE IF NOT EXISTS gift_items (
id TEXT PRIMARY KEY NOT NULL,
gift_id TEXT NOT NULL REFERENCES gifts(id) ON DELETE CASCADE,
type TEXT NOT NULL,
title TEXT,
text TEXT,
media_url TEXT,
sort_order INTEGER NOT NULL DEFAULT 0,
metadata TEXT NOT NULL DEFAULT '{}',
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT gift_items_type_check CHECK (length(trim(type)) > 0)
);
CREATE INDEX IF NOT EXISTS gift_items_gift_id_sort_order_idx
ON gift_items (gift_id, sort_order, id);