Automate diary entries and add photo galleries

This commit is contained in:
kai
2026-08-29 11:58:56 +02:00
parent 0b0b19b53a
commit b2af6c6857
7 changed files with 238 additions and 62 deletions
+16
View File
@@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS concert_diary_photos (
id SERIAL PRIMARY KEY,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
concert_id INTEGER NOT NULL REFERENCES concerts(id) ON DELETE CASCADE,
path TEXT NOT NULL UNIQUE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX IF NOT EXISTS idx_concert_diary_photos_entry
ON concert_diary_photos(user_id, concert_id, created_at);
INSERT INTO concert_diary_photos (user_id, concert_id, path)
SELECT user_id, concert_id, photo_path
FROM concert_diary
WHERE photo_path IS NOT NULL
ON CONFLICT (path) DO NOTHING;