diff --git a/via/migrations/versions/d4e3e1bf95eb_add_the_video_table.py b/via/migrations/versions/d4e3e1bf95eb_add_the_video_table.py new file mode 100644 index 00000000..3353ab6b --- /dev/null +++ b/via/migrations/versions/d4e3e1bf95eb_add_the_video_table.py @@ -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")