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 Jul 31, 2023
1 parent 64aef81 commit e570212
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(
"created", sa.DateTime(), server_default=sa.text("now()"), nullable=False
),
sa.Column(
"updated", sa.DateTime(), server_default=sa.text("now()"), nullable=False
),
sa.Column("id", sa.Integer(), autoincrement=True, 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 e570212

Please sign in to comment.