58e60d869326_add_notification_bool_to_pr.py 862 B

123456789101112131415161718192021222324252627282930313233
  1. """add notification bool to PR
  2. Revision ID: 58e60d869326
  3. Revises: 1b6d7dc5600a
  4. Create Date: 2016-02-12 12:39:07.839530
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '58e60d869326'
  8. down_revision = '1b6d7dc5600a'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. def upgrade():
  12. ''' Add the column notification to the table pull_request_comments.
  13. '''
  14. op.add_column(
  15. 'pull_request_comments',
  16. sa.Column('notification', sa.Boolean, default=False, nullable=True)
  17. )
  18. op.execute('''UPDATE "pull_request_comments" SET notification=False;''')
  19. op.alter_column(
  20. 'pull_request_comments', 'notification',
  21. nullable=False, existing_nullable=True)
  22. def downgrade():
  23. ''' Remove the column notification from the table pull_request_comments.
  24. '''
  25. op.drop_column('pull_request_comments', 'notification')