Skip to content

Commit

Permalink
Add migration to add video table
Browse files Browse the repository at this point in the history
  • Loading branch information
seanh committed Aug 3, 2023
1 parent f5b12e1 commit 665a5cb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions via/migrations/versions/d4e3e1bf95eb_add_the_video_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Add the video table.
Revision ID: d4e3e1bf95eb
Revises:
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql

revision = "d4e3e1bf95eb"
down_revision = "9a37efe13a91"


def upgrade() -> None:
op.create_table(
"video",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column(
"created", sa.DateTime(), server_default=sa.text("now()"), nullable=False
),
sa.Column(
"updated", sa.DateTime(), server_default=sa.text("now()"), nullable=False
),
sa.Column("video_id", sa.String(), nullable=False),
sa.Column("title", sa.String(), nullable=False),
sa.PrimaryKeyConstraint("id", name=op.f("pk_video")),
sa.UniqueConstraint("video_id", name=op.f("uq_video_video_id")),
)


def downgrade() -> None:
op.drop_table("video")

0 comments on commit 665a5cb

Please sign in to comment.