PCv5/migrations/versions/a8f539a93bd5_topics_add_sum...

37 lines
1.1 KiB
Python

"""Topics: add summary and thumbnail
Revision ID: a8f539a93bd5
Revises: 5ffc4e562ed8
Create Date: 2023-07-25 21:44:55.782425
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'a8f539a93bd5'
down_revision = '5ffc4e562ed8'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('topic', schema=None) as batch_op:
batch_op.add_column(sa.Column('summary', sa.UnicodeText(), nullable=True))
batch_op.add_column(sa.Column('thumbnail_id', postgresql.UUID(as_uuid=True), nullable=True))
batch_op.create_foreign_key(None, 'attachment', ['thumbnail_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('topic', schema=None) as batch_op:
batch_op.drop_constraint(None, type_='foreignkey')
batch_op.drop_column('thumbnail_id')
batch_op.drop_column('summary')
# ### end Alembic commands ###