add soft delete with trash page and group photo chronology with styling

This commit is contained in:
dev
2026-09-06 13:51:47 +03:00
parent 3c22d72a27
commit 621c3c3b5c
9 changed files with 594 additions and 45 deletions
+12
View File
@@ -17,6 +17,7 @@ CREATE TABLE IF NOT EXISTS entries (
group_id INT NOT NULL REFERENCES groups(id),
description TEXT NOT NULL,
photo_path VARCHAR(255),
deleted_at TIMESTAMPTZ,
created_at TIMESTAMPTZ DEFAULT now()
);
@@ -45,6 +46,17 @@ INSERT INTO groups (name) VALUES
('Advanced')
ON CONFLICT (name) DO NOTHING;
CREATE TABLE IF NOT EXISTS group_photos (
id SERIAL PRIMARY KEY,
group_id INT NOT NULL REFERENCES groups(id) ON DELETE CASCADE,
photo_path VARCHAR(255) NOT NULL,
caption TEXT,
taken_at DATE,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_group_photos_group_id ON group_photos(group_id);
CREATE TABLE IF NOT EXISTS project_files (
id SERIAL PRIMARY KEY,
entry_id INT NOT NULL REFERENCES entries(id) ON DELETE CASCADE,
+14 -1
View File
@@ -43,4 +43,17 @@ CREATE TABLE IF NOT EXISTS project_files (
UPDATE project_files SET token = md5(random()::text || clock_timestamp()::text) WHERE token IS NULL;
ALTER TABLE project_files ALTER COLUMN token SET NOT NULL;
CREATE UNIQUE INDEX IF NOT EXISTS project_files_token_key ON project_files(token);
CREATE UNIQUE INDEX IF NOT EXISTS project_files_token_key ON project_files(token);
ALTER TABLE entries ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ;
CREATE TABLE IF NOT EXISTS group_photos (
id SERIAL PRIMARY KEY,
group_id INT NOT NULL REFERENCES groups(id) ON DELETE CASCADE,
photo_path VARCHAR(255) NOT NULL,
caption TEXT,
taken_at DATE,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_group_photos_group_id ON group_photos(group_id);