11470abae0d6_add_key_notify_to_issue_keys.py 818 B

123456789101112131415161718192021222324252627282930313233343536
  1. """Add key_notify to the issues_keys table
  2. Revision ID: 11470abae0d6
  3. Revises: 987edda096f5
  4. Create Date: 2017-03-04 10:19:14.842910
  5. """
  6. # revision identifiers, used by Alembic.
  7. revision = '11470abae0d6'
  8. down_revision = '987edda096f5'
  9. from alembic import op
  10. import sqlalchemy as sa
  11. def upgrade():
  12. ''' Add a column to record if the custom field should trigger a email
  13. notification.
  14. '''
  15. op.add_column(
  16. 'issue_keys',
  17. sa.Column(
  18. 'key_notify', sa.Boolean, default=False, nullable=True
  19. )
  20. )
  21. op.execute('UPDATE issue_keys SET key_notify=False')
  22. op.alter_column(
  23. 'issue_keys', 'key_notify',
  24. nullable=False, existing_nullable=True)
  25. def downgrade():
  26. ''' Remove the key_notify column.
  27. '''
  28. op.drop_column('issue_keys', 'key_notify')