Fix the migration script to add and remove the logentrykinds for notifications.
This commit is contained in:
parent
b07eff41f6
commit
420d02cd71
1 changed files with 20 additions and 1 deletions
|
@ -86,6 +86,14 @@ def upgrade():
|
||||||
{'id':9, 'name':'build_failure'},
|
{'id':9, 'name':'build_failure'},
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# Manually add the new logentrykind types
|
||||||
|
op.bulk_insert(schema.tables['logentrykind'],
|
||||||
|
[
|
||||||
|
{'id':39, 'name':'add_repo_notification'},
|
||||||
|
{'id':40, 'name':'delete_repo_notification'},
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,7 +116,7 @@ def downgrade():
|
||||||
op.drop_index('externalnotificationmethod_name', table_name='externalnotificationmethod')
|
op.drop_index('externalnotificationmethod_name', table_name='externalnotificationmethod')
|
||||||
op.drop_table('externalnotificationmethod')
|
op.drop_table('externalnotificationmethod')
|
||||||
|
|
||||||
# Manually remove the notificationkind types
|
# Manually remove the notificationkind and logentrykind types
|
||||||
notificationkind = schema.tables['notificationkind']
|
notificationkind = schema.tables['notificationkind']
|
||||||
op.execute(
|
op.execute(
|
||||||
(notificationkind.delete()
|
(notificationkind.delete()
|
||||||
|
@ -134,5 +142,16 @@ def downgrade():
|
||||||
(notificationkind.delete()
|
(notificationkind.delete()
|
||||||
.where(notificationkind.c.name == op.inline_literal('build_failure')))
|
.where(notificationkind.c.name == op.inline_literal('build_failure')))
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
op.execute(
|
||||||
|
(logentrykind.delete()
|
||||||
|
.where(logentrykind.c.name == op.inline_literal('add_repo_notification')))
|
||||||
|
|
||||||
|
)
|
||||||
|
op.execute(
|
||||||
|
(logentrykind.delete()
|
||||||
|
.where(logentrykind.c.name == op.inline_literal('delete_repo_notification')))
|
||||||
|
|
||||||
)
|
)
|
||||||
### end Alembic commands ###
|
### end Alembic commands ###
|
||||||
|
|
Reference in a new issue