Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions wacruit/src/apps/pre_registration/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from sqlalchemy.orm import Mapped

from wacruit.src.database.base import DeclarativeBase
from wacruit.src.database.base import intpk
from wacruit.src.database.base import str30
from wacruit.src.database.base import str255


class PreRegistration(DeclarativeBase):
__tablename__ = "pre_registration"

id: Mapped[intpk]
url: Mapped[str255]
generation: Mapped[str30]
is_active: Mapped[bool]
13 changes: 13 additions & 0 deletions wacruit/src/apps/project/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class Project(DeclarativeBase):
secondary=project_member_association, back_populates="projects"
)
urls: Mapped[list["ProjectURL"]] = relationship(back_populates="source_project")
image_urls: Mapped[list["ProjectImageURL"]] = relationship(
back_populates="source_project"
)


class ProjectURL(DeclarativeBase):
Expand All @@ -50,3 +53,13 @@ class ProjectURL(DeclarativeBase):
url: Mapped[str255]

source_project: Mapped["Project"] = relationship(back_populates="urls")


class ProjectImageURL(DeclarativeBase):
__tablename__ = "project_image_url"

id: Mapped[intpk]
project_id: Mapped[int] = mapped_column(ForeignKey("project.id"))
url: Mapped[str255]

source_project: Mapped["Project"] = relationship(back_populates="image_urls")
2 changes: 0 additions & 2 deletions wacruit/src/apps/timeline/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
from wacruit.src.database.base import DeclarativeBase
from wacruit.src.database.base import intpk
from wacruit.src.database.base import str30
from wacruit.src.database.base import str255


class Timeline(DeclarativeBase):
__tablename__ = "timeline"

id: Mapped[intpk]
title: Mapped[str30]
content: Mapped[str255 | None]
category: Mapped[str30]
start_date: Mapped[datetime] = mapped_column(DateTime(timezone=True))
end_date: Mapped[datetime] = mapped_column(DateTime(timezone=True))
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""add table pre_registration, project image urls

Revision ID: f1b48402a49c
Revises: dfb42ebdb879
Create Date: 2025-07-04 09:24:20.626606

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = "f1b48402a49c"
down_revision = "dfb42ebdb879"
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"project_image_url",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("project_id", sa.Integer(), nullable=False),
sa.Column("url", sa.String(length=255), nullable=False),
sa.ForeignKeyConstraint(
["project_id"],
["project.id"],
),
sa.PrimaryKeyConstraint("id"),
)
op.drop_column("timeline", "content")
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"timeline", sa.Column("content", mysql.VARCHAR(length=255), nullable=True)
)
op.drop_table("project_image_url")
# ### end Alembic commands ###