make notification.key_type not nullable

set to 'normal' for all existing notifications, and all job notifications also created as 'normal' - so if your eg reporting service hits notify, it gets notifications created from both API calls and front-end csv jobs.
This commit is contained in:
Leo Hemsted
2016-07-01 16:30:45 +01:00
parent 2cf1d22748
commit f992240192
3 changed files with 32 additions and 3 deletions

View File

@@ -0,0 +1,27 @@
"""notification_api_key_not_nullable
Revision ID: 0036_notif_key_type_not_null
Revises: 0035_notification_type
Create Date: 2016-07-01 16:01:16.892638
"""
# revision identifiers, used by Alembic.
revision = '0036_notif_key_type_not_null'
down_revision = '0035_notification_type'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.execute("update notifications set key_type = 'normal' where key_type is null")
op.alter_column('notifications', 'key_type', existing_type=sa.VARCHAR(length=255), nullable=False)
### end Alembic commands ###
def downgrade():
### commands auto generated by Alembic - please adjust! ###
op.alter_column('notifications', 'key_type', existing_type=sa.VARCHAR(length=255), nullable=True)
### end Alembic commands ###