1
1
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yadc/migrations/versions/b1a3eed8e38f_.py

48 lines
1.7 KiB
Python

"""empty message
Revision ID: b1a3eed8e38f
Revises: f4e1b4727000
Create Date: 2020-03-09 23:58:53.716242
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utc
# revision identifiers, used by Alembic.
revision = 'b1a3eed8e38f'
down_revision = 'f4e1b4727000'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user_tags_blacklist',
sa.Column('user_id', sa.Integer(), nullable=True),
sa.Column('tag_id', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
)
op.add_column('user', sa.Column('ban_reason', sa.String(length=512), nullable=True))
op.add_column('user', sa.Column('ban_until', sqlalchemy_utc.sqltypes.UtcDateTime(timezone=True), nullable=True))
op.add_column('user', sa.Column('biography', sa.String(length=512), nullable=True))
op.add_column('user', sa.Column('rating', sa.Enum('safe', 'questionable', 'explicit', name='rating'), server_default='safe', nullable=False))
op.alter_column('user', 'op_level', server_default='user')
op.alter_column('user', 'user_status', server_default='active')
op.alter_column('post', 'status', server_default='pending')
op.alter_column('tag', 'category', server_default='general')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('user', 'rating')
op.drop_column('user', 'biography')
op.drop_column('user', 'ban_until')
op.drop_column('user', 'ban_reason')
op.drop_table('user_tags_blacklist')
# ### end Alembic commands ###