From 9a3cbf55bb59e5045d79cf44bb9edc7373c03ecc Mon Sep 17 00:00:00 2001 From: wailbentafat Date: Thu, 12 Mar 2026 18:21:09 +0100 Subject: [PATCH] feat: add schema migration for all tables --- .../sql/down/add-users-profile-fields.sql | 6 ++++ .../down/create-event-participants-table.sql | 4 +++ migrations/sql/down/create-events-table.sql | 6 ++++ .../sql/down/create-face-matches-table.sql | 4 +++ .../sql/down/create-notifications-table.sql | 4 +++ .../sql/down/create-photo-approvals-table.sql | 4 +++ .../sql/down/create-photo-faces-table.sql | 3 ++ migrations/sql/down/create-photos-table.sql | 6 ++++ .../sql/down/create-processing-jobs-table.sql | 5 ++++ .../sql/down/create-upload-requests-table.sql | 6 ++++ .../sql/down/create-user-photos-table.sql | 4 +++ migrations/sql/down/create_staff_user.sql | 4 +++ .../sql/up/add-users-profile-fields.sql | 6 ++++ .../up/create-event-participants-table.sql | 10 +++++++ migrations/sql/up/create-events-table.sql | 16 +++++++++++ .../sql/up/create-face-matches-table.sql | 10 +++++++ .../sql/up/create-notifications-table.sql | 11 ++++++++ .../sql/up/create-photo-approvals-table.sql | 10 +++++++ .../sql/up/create-photo-faces-table.sql | 11 ++++++++ migrations/sql/up/create-photos-table.sql | 17 +++++++++++ .../sql/up/create-processing-jobs-table.sql | 14 ++++++++++ .../sql/up/create-upload-requests-table.sql | 16 +++++++++++ .../sql/up/create-user-photos-table.sql | 11 ++++++++ .../042883327797_create_photo_faces_table.py | 25 +++++++++++++++++ .../0952572fe9b4_create_photos_table.py | 25 +++++++++++++++++ ...7f362c99e9_create_upload_requests_table.py | 25 +++++++++++++++++ .../1f6d3a37d12b_create_face_matches_table.py | 25 +++++++++++++++++ ...36c3d68f547f_create_notifications_table.py | 25 +++++++++++++++++ .../3ebf22bc9118_create_events_table.py | 25 +++++++++++++++++ .../4c6c265d0d15_add_users_profile_fields.py | 28 +++++++++++++++++++ ...8f0b1bd_create_event_participants_table.py | 25 +++++++++++++++++ .../5d10bf2ace55_create_user_photos_table.py | 25 +++++++++++++++++ ...f200d4cec7_create_processing_jobs_table.py | 25 +++++++++++++++++ ...9d627b8e27_create_photo_approvals_table.py | 25 +++++++++++++++++ 34 files changed, 466 insertions(+) create mode 100644 migrations/sql/down/add-users-profile-fields.sql create mode 100644 migrations/sql/down/create-event-participants-table.sql create mode 100644 migrations/sql/down/create-events-table.sql create mode 100644 migrations/sql/down/create-face-matches-table.sql create mode 100644 migrations/sql/down/create-notifications-table.sql create mode 100644 migrations/sql/down/create-photo-approvals-table.sql create mode 100644 migrations/sql/down/create-photo-faces-table.sql create mode 100644 migrations/sql/down/create-photos-table.sql create mode 100644 migrations/sql/down/create-processing-jobs-table.sql create mode 100644 migrations/sql/down/create-upload-requests-table.sql create mode 100644 migrations/sql/down/create-user-photos-table.sql create mode 100644 migrations/sql/up/add-users-profile-fields.sql create mode 100644 migrations/sql/up/create-event-participants-table.sql create mode 100644 migrations/sql/up/create-events-table.sql create mode 100644 migrations/sql/up/create-face-matches-table.sql create mode 100644 migrations/sql/up/create-notifications-table.sql create mode 100644 migrations/sql/up/create-photo-approvals-table.sql create mode 100644 migrations/sql/up/create-photo-faces-table.sql create mode 100644 migrations/sql/up/create-photos-table.sql create mode 100644 migrations/sql/up/create-processing-jobs-table.sql create mode 100644 migrations/sql/up/create-upload-requests-table.sql create mode 100644 migrations/sql/up/create-user-photos-table.sql create mode 100644 migrations/versions/042883327797_create_photo_faces_table.py create mode 100644 migrations/versions/0952572fe9b4_create_photos_table.py create mode 100644 migrations/versions/127f362c99e9_create_upload_requests_table.py create mode 100644 migrations/versions/1f6d3a37d12b_create_face_matches_table.py create mode 100644 migrations/versions/36c3d68f547f_create_notifications_table.py create mode 100644 migrations/versions/3ebf22bc9118_create_events_table.py create mode 100644 migrations/versions/4c6c265d0d15_add_users_profile_fields.py create mode 100644 migrations/versions/4ecce8f0b1bd_create_event_participants_table.py create mode 100644 migrations/versions/5d10bf2ace55_create_user_photos_table.py create mode 100644 migrations/versions/78f200d4cec7_create_processing_jobs_table.py create mode 100644 migrations/versions/b29d627b8e27_create_photo_approvals_table.py diff --git a/migrations/sql/down/add-users-profile-fields.sql b/migrations/sql/down/add-users-profile-fields.sql new file mode 100644 index 00000000..ae1a37ba --- /dev/null +++ b/migrations/sql/down/add-users-profile-fields.sql @@ -0,0 +1,6 @@ +DROP INDEX IF EXISTS idx_users_deleted_at; + +ALTER TABLE users + DROP COLUMN IF EXISTS deleted_at, + DROP COLUMN IF EXISTS face_embedding, + DROP COLUMN IF EXISTS display_name; diff --git a/migrations/sql/down/create-event-participants-table.sql b/migrations/sql/down/create-event-participants-table.sql new file mode 100644 index 00000000..7bd83315 --- /dev/null +++ b/migrations/sql/down/create-event-participants-table.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS idx_event_participants_user_id; +DROP INDEX IF EXISTS idx_event_participants_event_id; + +DROP TABLE IF EXISTS event_participants; diff --git a/migrations/sql/down/create-events-table.sql b/migrations/sql/down/create-events-table.sql new file mode 100644 index 00000000..66c4f429 --- /dev/null +++ b/migrations/sql/down/create-events-table.sql @@ -0,0 +1,6 @@ +DROP INDEX IF EXISTS idx_events_status; +DROP INDEX IF EXISTS idx_events_event_date; +DROP INDEX IF EXISTS idx_events_created_by; + +DROP TABLE IF EXISTS events; +DROP TYPE IF EXISTS event_status; diff --git a/migrations/sql/down/create-face-matches-table.sql b/migrations/sql/down/create-face-matches-table.sql new file mode 100644 index 00000000..065be3cc --- /dev/null +++ b/migrations/sql/down/create-face-matches-table.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS idx_face_matches_user_id; +DROP INDEX IF EXISTS idx_face_matches_face_id; + +DROP TABLE IF EXISTS face_matches; diff --git a/migrations/sql/down/create-notifications-table.sql b/migrations/sql/down/create-notifications-table.sql new file mode 100644 index 00000000..f75e0ae1 --- /dev/null +++ b/migrations/sql/down/create-notifications-table.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS idx_notifications_read_at; +DROP INDEX IF EXISTS idx_notifications_user_id; + +DROP TABLE IF EXISTS notifications; diff --git a/migrations/sql/down/create-photo-approvals-table.sql b/migrations/sql/down/create-photo-approvals-table.sql new file mode 100644 index 00000000..67d9ed50 --- /dev/null +++ b/migrations/sql/down/create-photo-approvals-table.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS idx_photo_approvals_user_id; +DROP INDEX IF EXISTS idx_photo_approvals_photo_id; + +DROP TABLE IF EXISTS photo_approvals; diff --git a/migrations/sql/down/create-photo-faces-table.sql b/migrations/sql/down/create-photo-faces-table.sql new file mode 100644 index 00000000..b970bc8f --- /dev/null +++ b/migrations/sql/down/create-photo-faces-table.sql @@ -0,0 +1,3 @@ +DROP INDEX IF EXISTS idx_photo_faces_photo_id; + +DROP TABLE IF EXISTS photo_faces; diff --git a/migrations/sql/down/create-photos-table.sql b/migrations/sql/down/create-photos-table.sql new file mode 100644 index 00000000..cf03cca4 --- /dev/null +++ b/migrations/sql/down/create-photos-table.sql @@ -0,0 +1,6 @@ +DROP INDEX IF EXISTS idx_photos_status; +DROP INDEX IF EXISTS idx_photos_uploaded_by; +DROP INDEX IF EXISTS idx_photos_event_id; + +DROP TABLE IF EXISTS photos; +DROP TYPE IF EXISTS photo_status; diff --git a/migrations/sql/down/create-processing-jobs-table.sql b/migrations/sql/down/create-processing-jobs-table.sql new file mode 100644 index 00000000..4141effe --- /dev/null +++ b/migrations/sql/down/create-processing-jobs-table.sql @@ -0,0 +1,5 @@ +DROP INDEX IF EXISTS idx_processing_jobs_status; +DROP INDEX IF EXISTS idx_processing_jobs_photo_id; + +DROP TABLE IF EXISTS processing_jobs; +DROP TYPE IF EXISTS processing_job_status; diff --git a/migrations/sql/down/create-upload-requests-table.sql b/migrations/sql/down/create-upload-requests-table.sql new file mode 100644 index 00000000..16515982 --- /dev/null +++ b/migrations/sql/down/create-upload-requests-table.sql @@ -0,0 +1,6 @@ +DROP INDEX IF EXISTS idx_upload_requests_status; +DROP INDEX IF EXISTS idx_upload_requests_requested_by; +DROP INDEX IF EXISTS idx_upload_requests_event_id; + +DROP TABLE IF EXISTS upload_requests; +DROP TYPE IF EXISTS upload_request_status; diff --git a/migrations/sql/down/create-user-photos-table.sql b/migrations/sql/down/create-user-photos-table.sql new file mode 100644 index 00000000..7209fd64 --- /dev/null +++ b/migrations/sql/down/create-user-photos-table.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS idx_user_photos_photo_id; +DROP INDEX IF EXISTS idx_user_photos_user_id; + +DROP TABLE IF EXISTS user_photos; diff --git a/migrations/sql/down/create_staff_user.sql b/migrations/sql/down/create_staff_user.sql index e69de29b..71a6d1cd 100644 --- a/migrations/sql/down/create_staff_user.sql +++ b/migrations/sql/down/create_staff_user.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS idx_staff_users_discord_id; + +DROP TABLE IF EXISTS staff_users; +DROP TYPE IF EXISTS staff_role; diff --git a/migrations/sql/up/add-users-profile-fields.sql b/migrations/sql/up/add-users-profile-fields.sql new file mode 100644 index 00000000..e69ea6fa --- /dev/null +++ b/migrations/sql/up/add-users-profile-fields.sql @@ -0,0 +1,6 @@ +ALTER TABLE users + ADD COLUMN IF NOT EXISTS display_name TEXT, + ADD COLUMN IF NOT EXISTS face_embedding VECTOR(1536), + ADD COLUMN IF NOT EXISTS deleted_at TIMESTAMPTZ; + +CREATE INDEX IF NOT EXISTS idx_users_deleted_at ON users(deleted_at); diff --git a/migrations/sql/up/create-event-participants-table.sql b/migrations/sql/up/create-event-participants-table.sql new file mode 100644 index 00000000..96c14ae1 --- /dev/null +++ b/migrations/sql/up/create-event-participants-table.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS event_participants ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + event_id UUID NOT NULL REFERENCES events(id) ON DELETE CASCADE, + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + joined_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + UNIQUE(event_id, user_id) +); + +CREATE INDEX IF NOT EXISTS idx_event_participants_event_id ON event_participants(event_id); +CREATE INDEX IF NOT EXISTS idx_event_participants_user_id ON event_participants(user_id); diff --git a/migrations/sql/up/create-events-table.sql b/migrations/sql/up/create-events-table.sql new file mode 100644 index 00000000..137cc40c --- /dev/null +++ b/migrations/sql/up/create-events-table.sql @@ -0,0 +1,16 @@ +CREATE TYPE event_status AS ENUM ('draft', 'scheduled', 'archived'); + +CREATE TABLE IF NOT EXISTS events ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + name TEXT NOT NULL, + event_code VARCHAR(64) NOT NULL UNIQUE, + event_date TIMESTAMPTZ NOT NULL, + status event_status NOT NULL DEFAULT 'draft', + created_by UUID NOT NULL REFERENCES staff_users(id) ON DELETE RESTRICT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + archived_at TIMESTAMPTZ +); + +CREATE INDEX IF NOT EXISTS idx_events_created_by ON events(created_by); +CREATE INDEX IF NOT EXISTS idx_events_event_date ON events(event_date); +CREATE INDEX IF NOT EXISTS idx_events_status ON events(status); diff --git a/migrations/sql/up/create-face-matches-table.sql b/migrations/sql/up/create-face-matches-table.sql new file mode 100644 index 00000000..ed73cdc8 --- /dev/null +++ b/migrations/sql/up/create-face-matches-table.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS face_matches ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + photo_face_id UUID NOT NULL REFERENCES photo_faces(id) ON DELETE CASCADE, + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + confidence DOUBLE PRECISION NOT NULL, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_face_matches_face_id ON face_matches(photo_face_id); +CREATE INDEX IF NOT EXISTS idx_face_matches_user_id ON face_matches(user_id); diff --git a/migrations/sql/up/create-notifications-table.sql b/migrations/sql/up/create-notifications-table.sql new file mode 100644 index 00000000..580fc127 --- /dev/null +++ b/migrations/sql/up/create-notifications-table.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS notifications ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + type VARCHAR(64) NOT NULL, + payload JSONB NOT NULL, + read_at TIMESTAMPTZ, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_notifications_user_id ON notifications(user_id); +CREATE INDEX IF NOT EXISTS idx_notifications_read_at ON notifications(read_at); diff --git a/migrations/sql/up/create-photo-approvals-table.sql b/migrations/sql/up/create-photo-approvals-table.sql new file mode 100644 index 00000000..6a947f66 --- /dev/null +++ b/migrations/sql/up/create-photo-approvals-table.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS photo_approvals ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + photo_id UUID NOT NULL REFERENCES photos(id) ON DELETE CASCADE, + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + decision VARCHAR(32) NOT NULL, + decided_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_photo_approvals_photo_id ON photo_approvals(photo_id); +CREATE INDEX IF NOT EXISTS idx_photo_approvals_user_id ON photo_approvals(user_id); diff --git a/migrations/sql/up/create-photo-faces-table.sql b/migrations/sql/up/create-photo-faces-table.sql new file mode 100644 index 00000000..e4e5a13a --- /dev/null +++ b/migrations/sql/up/create-photo-faces-table.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS photo_faces ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + photo_id UUID NOT NULL REFERENCES photos(id) ON DELETE CASCADE, + face_index INT NOT NULL, + embedding VECTOR(1536), + bbox TEXT, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + UNIQUE(photo_id, face_index) +); + +CREATE INDEX IF NOT EXISTS idx_photo_faces_photo_id ON photo_faces(photo_id); diff --git a/migrations/sql/up/create-photos-table.sql b/migrations/sql/up/create-photos-table.sql new file mode 100644 index 00000000..219e5aa6 --- /dev/null +++ b/migrations/sql/up/create-photos-table.sql @@ -0,0 +1,17 @@ +CREATE TYPE photo_status AS ENUM ('pending', 'approved', 'rejected'); + +CREATE TABLE IF NOT EXISTS photos ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + event_id UUID NOT NULL REFERENCES events(id) ON DELETE CASCADE, + uploaded_by UUID REFERENCES users(id) ON DELETE SET NULL, + storage_key TEXT NOT NULL, + taken_at TIMESTAMPTZ, + day_number INT, + visibility VARCHAR(32) NOT NULL DEFAULT 'private', + status photo_status NOT NULL DEFAULT 'pending', + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW() +); + +CREATE INDEX IF NOT EXISTS idx_photos_event_id ON photos(event_id); +CREATE INDEX IF NOT EXISTS idx_photos_uploaded_by ON photos(uploaded_by); +CREATE INDEX IF NOT EXISTS idx_photos_status ON photos(status); diff --git a/migrations/sql/up/create-processing-jobs-table.sql b/migrations/sql/up/create-processing-jobs-table.sql new file mode 100644 index 00000000..83e60800 --- /dev/null +++ b/migrations/sql/up/create-processing-jobs-table.sql @@ -0,0 +1,14 @@ +CREATE TYPE processing_job_status AS ENUM ('pending', 'running', 'completed', 'failed'); + +CREATE TABLE IF NOT EXISTS processing_jobs ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + photo_id UUID NOT NULL REFERENCES photos(id) ON DELETE CASCADE, + job_type VARCHAR(64) NOT NULL, + status processing_job_status NOT NULL DEFAULT 'pending', + attempts INT NOT NULL DEFAULT 0, + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + completed_at TIMESTAMPTZ +); + +CREATE INDEX IF NOT EXISTS idx_processing_jobs_photo_id ON processing_jobs(photo_id); +CREATE INDEX IF NOT EXISTS idx_processing_jobs_status ON processing_jobs(status); diff --git a/migrations/sql/up/create-upload-requests-table.sql b/migrations/sql/up/create-upload-requests-table.sql new file mode 100644 index 00000000..fdcf4daf --- /dev/null +++ b/migrations/sql/up/create-upload-requests-table.sql @@ -0,0 +1,16 @@ +CREATE TYPE upload_request_status AS ENUM ('pending', 'approved', 'rejected'); + +CREATE TABLE IF NOT EXISTS upload_requests ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + event_id UUID NOT NULL REFERENCES events(id) ON DELETE CASCADE, + drive_file_id TEXT NOT NULL, + requested_by UUID NOT NULL REFERENCES staff_users(id) ON DELETE RESTRICT, + approved_by UUID REFERENCES staff_users(id) ON DELETE SET NULL, + status upload_request_status NOT NULL DEFAULT 'pending', + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + approved_at TIMESTAMPTZ +); + +CREATE INDEX IF NOT EXISTS idx_upload_requests_event_id ON upload_requests(event_id); +CREATE INDEX IF NOT EXISTS idx_upload_requests_requested_by ON upload_requests(requested_by); +CREATE INDEX IF NOT EXISTS idx_upload_requests_status ON upload_requests(status); diff --git a/migrations/sql/up/create-user-photos-table.sql b/migrations/sql/up/create-user-photos-table.sql new file mode 100644 index 00000000..876786b3 --- /dev/null +++ b/migrations/sql/up/create-user-photos-table.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS user_photos ( + id UUID PRIMARY KEY DEFAULT uuid_generate_v4(), + user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE, + photo_id UUID NOT NULL REFERENCES photos(id) ON DELETE CASCADE, + visibility VARCHAR(32) NOT NULL DEFAULT 'private', + created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(), + UNIQUE(user_id, photo_id) +); + +CREATE INDEX IF NOT EXISTS idx_user_photos_user_id ON user_photos(user_id); +CREATE INDEX IF NOT EXISTS idx_user_photos_photo_id ON user_photos(photo_id); diff --git a/migrations/versions/042883327797_create_photo_faces_table.py b/migrations/versions/042883327797_create_photo_faces_table.py new file mode 100644 index 00000000..b85dd86f --- /dev/null +++ b/migrations/versions/042883327797_create_photo_faces_table.py @@ -0,0 +1,25 @@ +"""create-photo-faces-table + +Revision ID: 042883327797 +Revises: b29d627b8e27 +Create Date: 2026-03-12 18:07:41.843182 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '042883327797' +down_revision: Union[str, Sequence[str], None] = 'b29d627b8e27' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-photo-faces-table") + + +def downgrade() -> None: + run_sql_down("create-photo-faces-table") diff --git a/migrations/versions/0952572fe9b4_create_photos_table.py b/migrations/versions/0952572fe9b4_create_photos_table.py new file mode 100644 index 00000000..9d0d6dbd --- /dev/null +++ b/migrations/versions/0952572fe9b4_create_photos_table.py @@ -0,0 +1,25 @@ +"""create-photos-table + +Revision ID: 0952572fe9b4 +Revises: 36c3d68f547f +Create Date: 2026-03-12 18:06:18.603970 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '0952572fe9b4' +down_revision: Union[str, Sequence[str], None] = '36c3d68f547f' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-photos-table") + + +def downgrade() -> None: + run_sql_down("create-photos-table") diff --git a/migrations/versions/127f362c99e9_create_upload_requests_table.py b/migrations/versions/127f362c99e9_create_upload_requests_table.py new file mode 100644 index 00000000..c95a0662 --- /dev/null +++ b/migrations/versions/127f362c99e9_create_upload_requests_table.py @@ -0,0 +1,25 @@ +"""create-upload-requests-table + +Revision ID: 127f362c99e9 +Revises: 78f200d4cec7 +Create Date: 2026-03-12 18:08:53.285973 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '127f362c99e9' +down_revision: Union[str, Sequence[str], None] = '78f200d4cec7' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-upload-requests-table") + + +def downgrade() -> None: + run_sql_down("create-upload-requests-table") diff --git a/migrations/versions/1f6d3a37d12b_create_face_matches_table.py b/migrations/versions/1f6d3a37d12b_create_face_matches_table.py new file mode 100644 index 00000000..1ac254fb --- /dev/null +++ b/migrations/versions/1f6d3a37d12b_create_face_matches_table.py @@ -0,0 +1,25 @@ +"""create-face-matches-table + +Revision ID: 1f6d3a37d12b +Revises: 042883327797 +Create Date: 2026-03-12 18:08:08.162096 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '1f6d3a37d12b' +down_revision: Union[str, Sequence[str], None] = '042883327797' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-face-matches-table") + + +def downgrade() -> None: + run_sql_down("create-face-matches-table") diff --git a/migrations/versions/36c3d68f547f_create_notifications_table.py b/migrations/versions/36c3d68f547f_create_notifications_table.py new file mode 100644 index 00000000..91ab668b --- /dev/null +++ b/migrations/versions/36c3d68f547f_create_notifications_table.py @@ -0,0 +1,25 @@ +"""create-notifications-table + +Revision ID: 36c3d68f547f +Revises: 4ecce8f0b1bd +Create Date: 2026-03-12 18:05:49.743263 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '36c3d68f547f' +down_revision: Union[str, Sequence[str], None] = '4ecce8f0b1bd' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-notifications-table") + + +def downgrade() -> None: + run_sql_down("create-notifications-table") diff --git a/migrations/versions/3ebf22bc9118_create_events_table.py b/migrations/versions/3ebf22bc9118_create_events_table.py new file mode 100644 index 00000000..c897690d --- /dev/null +++ b/migrations/versions/3ebf22bc9118_create_events_table.py @@ -0,0 +1,25 @@ +"""create-events-table + +Revision ID: 3ebf22bc9118 +Revises: 4c6c265d0d15 +Create Date: 2026-03-12 18:05:08.081468 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '3ebf22bc9118' +down_revision: Union[str, Sequence[str], None] = '4c6c265d0d15' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-events-table") + + +def downgrade() -> None: + run_sql_down("create-events-table") diff --git a/migrations/versions/4c6c265d0d15_add_users_profile_fields.py b/migrations/versions/4c6c265d0d15_add_users_profile_fields.py new file mode 100644 index 00000000..10d68b78 --- /dev/null +++ b/migrations/versions/4c6c265d0d15_add_users_profile_fields.py @@ -0,0 +1,28 @@ +"""add-users-profile-fields + +Revision ID: 4c6c265d0d15 +Revises: b037dbfdbb1f +Create Date: 2026-03-12 18:04:51.055109 + +""" +from typing import Sequence, Union + +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision: str = '4c6c265d0d15' +down_revision: Union[str, Sequence[str], None] = 'b037dbfdbb1f' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + """Upgrade schema.""" + pass + + +def downgrade() -> None: + """Downgrade schema.""" + pass diff --git a/migrations/versions/4ecce8f0b1bd_create_event_participants_table.py b/migrations/versions/4ecce8f0b1bd_create_event_participants_table.py new file mode 100644 index 00000000..cffcc2f2 --- /dev/null +++ b/migrations/versions/4ecce8f0b1bd_create_event_participants_table.py @@ -0,0 +1,25 @@ +"""create-event-participants-table + +Revision ID: 4ecce8f0b1bd +Revises: 3ebf22bc9118 +Create Date: 2026-03-12 18:05:25.382712 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '4ecce8f0b1bd' +down_revision: Union[str, Sequence[str], None] = '3ebf22bc9118' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-event-participants-table") + + +def downgrade() -> None: + run_sql_down("create-event-participants-table") diff --git a/migrations/versions/5d10bf2ace55_create_user_photos_table.py b/migrations/versions/5d10bf2ace55_create_user_photos_table.py new file mode 100644 index 00000000..6b661c85 --- /dev/null +++ b/migrations/versions/5d10bf2ace55_create_user_photos_table.py @@ -0,0 +1,25 @@ +"""create-user-photos-table + +Revision ID: 5d10bf2ace55 +Revises: 0952572fe9b4 +Create Date: 2026-03-12 18:06:41.287720 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '5d10bf2ace55' +down_revision: Union[str, Sequence[str], None] = '0952572fe9b4' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-user-photos-table") + + +def downgrade() -> None: + run_sql_down("create-user-photos-table") diff --git a/migrations/versions/78f200d4cec7_create_processing_jobs_table.py b/migrations/versions/78f200d4cec7_create_processing_jobs_table.py new file mode 100644 index 00000000..5a0187c6 --- /dev/null +++ b/migrations/versions/78f200d4cec7_create_processing_jobs_table.py @@ -0,0 +1,25 @@ +"""create-processing-jobs-table + +Revision ID: 78f200d4cec7 +Revises: 1f6d3a37d12b +Create Date: 2026-03-12 18:08:29.516343 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = '78f200d4cec7' +down_revision: Union[str, Sequence[str], None] = '1f6d3a37d12b' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-processing-jobs-table") + + +def downgrade() -> None: + run_sql_down("create-processing-jobs-table") diff --git a/migrations/versions/b29d627b8e27_create_photo_approvals_table.py b/migrations/versions/b29d627b8e27_create_photo_approvals_table.py new file mode 100644 index 00000000..183f0d32 --- /dev/null +++ b/migrations/versions/b29d627b8e27_create_photo_approvals_table.py @@ -0,0 +1,25 @@ +"""create-photo-approvals-table + +Revision ID: b29d627b8e27 +Revises: 5d10bf2ace55 +Create Date: 2026-03-12 18:07:12.715390 + +""" +from typing import Sequence, Union + +from migrations.helper import run_sql_down, run_sql_up + + +# revision identifiers, used by Alembic. +revision: str = 'b29d627b8e27' +down_revision: Union[str, Sequence[str], None] = '5d10bf2ace55' +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + run_sql_up("create-photo-approvals-table") + + +def downgrade() -> None: + run_sql_down("create-photo-approvals-table")