331500ad355b_make_post_and_topic_hideable_models.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. """Make post and topic hideable models
  2. Revision ID: 331500ad355b
  3. Revises:
  4. Create Date: 2017-09-03 17:03:06.460391
  5. """
  6. from alembic import op
  7. import sqlalchemy as sa
  8. from flaskbb.utils.database import UTCDateTime
  9. # revision identifiers, used by Alembic.
  10. revision = '331500ad355b'
  11. down_revision = None
  12. branch_labels = ('default',)
  13. depends_on = None
  14. def upgrade():
  15. # ### commands auto generated by Alembic - please adjust! ###
  16. with op.batch_alter_table('posts', schema=None) as batch_op:
  17. batch_op.add_column(sa.Column('hidden', sa.Boolean(), nullable=True))
  18. batch_op.add_column(sa.Column('hidden_at', UTCDateTime(timezone=True), nullable=True))
  19. with op.batch_alter_table('topics', schema=None) as batch_op:
  20. batch_op.add_column(sa.Column('hidden', sa.Boolean(), nullable=True))
  21. batch_op.add_column(sa.Column('hidden_at', UTCDateTime(timezone=True), nullable=True))
  22. # ### end Alembic commands ###
  23. def downgrade():
  24. # ### commands auto generated by Alembic - please adjust! ###
  25. with op.batch_alter_table('topics', schema=None) as batch_op:
  26. batch_op.drop_column('hidden_at')
  27. batch_op.drop_column('hidden')
  28. with op.batch_alter_table('posts', schema=None) as batch_op:
  29. batch_op.drop_column('hidden_at')
  30. batch_op.drop_column('hidden')
  31. # ### end Alembic commands ###