From 420d02cd713c81215b4beff79e6356044f793dc8 Mon Sep 17 00:00:00 2001 From: yackob03 Date: Tue, 5 Aug 2014 14:21:29 -0700 Subject: [PATCH] Fix the migration script to add and remove the logentrykinds for notifications. --- ...c79d9_prepare_the_database_for_the_new_.py | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py b/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py index 722438c42..18c8bf654 100644 --- a/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py +++ b/data/migrations/versions/325a4d7c79d9_prepare_the_database_for_the_new_.py @@ -86,6 +86,14 @@ def upgrade(): {'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 ### @@ -108,7 +116,7 @@ def downgrade(): op.drop_index('externalnotificationmethod_name', table_name='externalnotificationmethod') op.drop_table('externalnotificationmethod') - # Manually remove the notificationkind types + # Manually remove the notificationkind and logentrykind types notificationkind = schema.tables['notificationkind'] op.execute( (notificationkind.delete() @@ -134,5 +142,16 @@ def downgrade(): (notificationkind.delete() .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 ###