From c4361a7813cb5920de679807c32fc1d6efafab94 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 19 2016 22:08:25 +0000 Subject: Add an alembic migration script adding the notification field --- diff --git a/alembic/versions/58e60d869326_add_notification_bool_to_pr.py b/alembic/versions/58e60d869326_add_notification_bool_to_pr.py new file mode 100644 index 0000000..164b730 --- /dev/null +++ b/alembic/versions/58e60d869326_add_notification_bool_to_pr.py @@ -0,0 +1,33 @@ +"""add notification bool to PR + +Revision ID: 58e60d869326 +Revises: 1b6d7dc5600a +Create Date: 2016-02-12 12:39:07.839530 + +""" + +# revision identifiers, used by Alembic. +revision = '58e60d869326' +down_revision = '1b6d7dc5600a' + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ''' Add the column merge_status to the table projects. + ''' + op.add_column( + 'pull_request_comments', + sa.Column('notification', sa.Boolean, default=False, nullable=True) + ) + op.execute('''UPDATE "pull_request_comments" SET notification=False;''') + op.alter_column( + 'pull_request_comments', 'notification', + nullable=False, existing_nullable=True) + + +def downgrade(): + ''' Remove the column merge_status from the table projects. + ''' + op.drop_column('pull_request_comments', 'notification')