-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DB migration for transcript table
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
via/migrations/versions/9a37efe13a91_add_the_transcript_table.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"""Add the transcript table. | ||
Revision ID: 9a37efe13a91 | ||
Revises: | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
revision = "9a37efe13a91" | ||
down_revision = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
"transcript", | ||
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("transcript_id", sa.String(), nullable=False), | ||
sa.Column( | ||
"transcript", postgresql.JSONB(astext_type=sa.Text()), nullable=False | ||
), | ||
sa.PrimaryKeyConstraint("id", name=op.f("pk_transcript")), | ||
sa.UniqueConstraint( | ||
"video_id", | ||
"transcript_id", | ||
name=op.f("uq_transcript_video_id_transcript_id"), | ||
), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table("transcript") |