contentdb/migrations/versions/4f2e19bc2a27_.py
rubenwardy 307b8f8dde Add reviews
Fixes #173
2020-07-09 04:10:09 +01:00

41 lines
1.2 KiB
Python

"""empty message
Revision ID: 4f2e19bc2a27
Revises: dd27f1311a90
Create Date: 2020-07-09 00:35:35.066719
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4f2e19bc2a27'
down_revision = 'dd27f1311a90'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('package_review',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('package_id', sa.Integer(), nullable=True),
sa.Column('author_id', sa.Integer(), nullable=False),
sa.Column('recommends', sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(['author_id'], ['user.id'], ),
sa.ForeignKeyConstraint(['package_id'], ['package.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.add_column('thread', sa.Column('review_id', sa.Integer(), nullable=True))
op.create_foreign_key(None, 'thread', 'package_review', ['review_id'], ['id'])
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'thread', type_='foreignkey')
op.drop_column('thread', 'review_id')
op.drop_table('package_review')
# ### end Alembic commands ###