57 lines
2 KiB
Python
57 lines
2 KiB
Python
"""initial migration
|
|
|
|
Revision ID: 9efcecc1e58d
|
|
Revises:
|
|
Create Date: 2025-02-03 18:45:42.630841
|
|
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
import sqlalchemy as sa
|
|
import sqlmodel
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "9efcecc1e58d"
|
|
down_revision: Union[str, None] = None
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table(
|
|
"podcast",
|
|
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column("explicit", sa.Boolean(), nullable=False),
|
|
sa.Column("id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column("owner_id", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
sa.Column("image_filename", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
op.create_table(
|
|
"podcastepisode",
|
|
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column("duration", sa.Float(), nullable=True),
|
|
sa.Column("description", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
|
sa.Column("file_hash", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column("file_size", sa.Integer(), nullable=False),
|
|
sa.Column("publish_date", sa.DateTime(), nullable=False),
|
|
sa.Column("id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.Column("podcast_id", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
sa.ForeignKeyConstraint(
|
|
["podcast_id"],
|
|
["podcast.id"],
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table("podcastepisode")
|
|
op.drop_table("podcast")
|
|
# ### end Alembic commands ###
|