fix(migration)
Some checks failed
Deploy to Development / build-and-deploy (push) Has been cancelled
Deploy to Production / build-and-deploy (push) Successful in 1m3s

This commit is contained in:
EvanChal
2026-01-25 23:07:42 +01:00
parent cb11a74d33
commit 127aef60e3
2 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,54 @@
"""Initial schema
Revision ID: 0001_initial
Revises:
Create Date: 2026-01-25 19:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy import inspect
from config.database import Base
# Import all models to ensure they're registered with Base.metadata
from models import (
User,
Event,
EventParticipation,
Album,
Media,
MediaLike,
Post,
PostMention,
PostLike,
PostComment,
Vlog,
VlogLike,
VlogComment,
Notification,
SystemSettings,
Information,
Ticket
)
# revision identifiers, used by Alembic.
revision: str = '0001_initial'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# Create all tables using Base.metadata with the Alembic connection
# This uses the connection from the Alembic context
bind = op.get_bind()
Base.metadata.create_all(bind=bind)
def downgrade() -> None:
# Drop all tables
bind = op.get_bind()
Base.metadata.drop_all(bind=bind)

View File

@@ -13,7 +13,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '89527c8da8e1'
down_revision: Union[str, None] = None
down_revision: Union[str, None] = '0001_initial'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None