Blame alembic/versions/58e60d869326_add_notification_bool_to_pr.py
|
Pierre-Yves Chibon |
c4361a |
"""add notification bool to PR
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
Revision ID: 58e60d869326
|
|
Pierre-Yves Chibon |
c4361a |
Revises: 1b6d7dc5600a
|
|
Pierre-Yves Chibon |
c4361a |
Create Date: 2016-02-12 12:39:07.839530
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
"""
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
# revision identifiers, used by Alembic.
|
|
Pierre-Yves Chibon |
c4361a |
revision = '58e60d869326'
|
|
Pierre-Yves Chibon |
c4361a |
down_revision = '1b6d7dc5600a'
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
from alembic import op
|
|
Pierre-Yves Chibon |
c4361a |
import sqlalchemy as sa
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
def upgrade():
|
|
Pierre-Yves Chibon |
92563f |
''' Add the column notification to the table pull_request_comments.
|
|
Pierre-Yves Chibon |
c4361a |
'''
|
|
Pierre-Yves Chibon |
c4361a |
op.add_column(
|
|
Pierre-Yves Chibon |
c4361a |
'pull_request_comments',
|
|
Pierre-Yves Chibon |
c4361a |
sa.Column('notification', sa.Boolean, default=False, nullable=True)
|
|
Pierre-Yves Chibon |
c4361a |
)
|
|
Pierre-Yves Chibon |
c4361a |
op.execute('''UPDATE "pull_request_comments" SET notification=False;''')
|
|
Pierre-Yves Chibon |
c4361a |
op.alter_column(
|
|
Pierre-Yves Chibon |
c4361a |
'pull_request_comments', 'notification',
|
|
Pierre-Yves Chibon |
c4361a |
nullable=False, existing_nullable=True)
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
|
|
Pierre-Yves Chibon |
c4361a |
def downgrade():
|
|
Pierre-Yves Chibon |
92563f |
''' Remove the column notification from the table pull_request_comments.
|
|
Pierre-Yves Chibon |
c4361a |
'''
|
|
Pierre-Yves Chibon |
c4361a |
op.drop_column('pull_request_comments', 'notification')
|