From 3f6466fccdd596a67330e9a82b58e350d78abec5 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Thu, 31 Jul 2014 14:01:03 -0400 Subject: [PATCH] Add a migration to move the existing webhooks over and another migration to remove the legacy webhooks table. --- ...e50775_remove_the_legacy_webhooks_table.py | 35 +++++++++++++++++++ ...670cbeced_migrate_existing_webhooks_to_.py | 22 ++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 data/migrations/versions/2d9b90e50775_remove_the_legacy_webhooks_table.py create mode 100644 data/migrations/versions/47670cbeced_migrate_existing_webhooks_to_.py diff --git a/data/migrations/versions/2d9b90e50775_remove_the_legacy_webhooks_table.py b/data/migrations/versions/2d9b90e50775_remove_the_legacy_webhooks_table.py new file mode 100644 index 000000000..8cac218c8 --- /dev/null +++ b/data/migrations/versions/2d9b90e50775_remove_the_legacy_webhooks_table.py @@ -0,0 +1,35 @@ +"""Remove the legacy webhooks table + +Revision ID: 2d9b90e50775 +Revises: 47670cbeced +Create Date: 2014-07-31 13:56:10.702609 + +""" + +# revision identifiers, used by Alembic. +revision = '2d9b90e50775' +down_revision = '47670cbeced' + +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_table('webhook') + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.create_table('webhook', + sa.Column('id', mysql.INTEGER(display_width=11), nullable=False), + sa.Column('public_id', mysql.VARCHAR(length=255), nullable=False), + sa.Column('repository_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=False), + sa.Column('parameters', mysql.LONGTEXT(), nullable=False), + sa.ForeignKeyConstraint(['repository_id'], [u'repository.id'], name=u'fk_webhook_repository_repository_id'), + sa.PrimaryKeyConstraint('id'), + mysql_default_charset=u'latin1', + mysql_engine=u'InnoDB' + ) + ### end Alembic commands ### diff --git a/data/migrations/versions/47670cbeced_migrate_existing_webhooks_to_.py b/data/migrations/versions/47670cbeced_migrate_existing_webhooks_to_.py new file mode 100644 index 000000000..c956250c4 --- /dev/null +++ b/data/migrations/versions/47670cbeced_migrate_existing_webhooks_to_.py @@ -0,0 +1,22 @@ +"""Migrate existing webhooks to notifications. + +Revision ID: 47670cbeced +Revises: 325a4d7c79d9 +Create Date: 2014-07-31 13:49:38.332807 + +""" + +# revision identifiers, used by Alembic. +revision = '47670cbeced' +down_revision = '325a4d7c79d9' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + pass + + +def downgrade(): + pass