Blame alembic/versions/22db0a833d35_add_notifications_to_tickets.py
|
Pierre-Yves Chibon |
65d1e3 |
"""Add notifications to tickets
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
Revision ID: 22db0a833d35
|
|
Pierre-Yves Chibon |
65d1e3 |
Revises: 317a285e04a8
|
|
Pierre-Yves Chibon |
65d1e3 |
Create Date: 2016-06-27 16:10:33.395495
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
"""
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
# revision identifiers, used by Alembic.
|
|
Pierre-Yves Chibon |
65d1e3 |
revision = '22db0a833d35'
|
|
Pierre-Yves Chibon |
65d1e3 |
down_revision = '317a285e04a8'
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
from alembic import op
|
|
Pierre-Yves Chibon |
65d1e3 |
import sqlalchemy as sa
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
def upgrade():
|
|
Pierre-Yves Chibon |
65d1e3 |
''' Add the column notification to the table issue_comments.
|
|
Pierre-Yves Chibon |
65d1e3 |
'''
|
|
Pierre-Yves Chibon |
65d1e3 |
op.add_column(
|
|
Pierre-Yves Chibon |
65d1e3 |
'issue_comments',
|
|
Pierre-Yves Chibon |
65d1e3 |
sa.Column('notification', sa.Boolean, default=False, nullable=True)
|
|
Pierre-Yves Chibon |
65d1e3 |
)
|
|
Pierre-Yves Chibon |
65d1e3 |
op.execute('''UPDATE "issue_comments" SET notification=False;''')
|
|
Pierre-Yves Chibon |
65d1e3 |
op.alter_column(
|
|
Pierre-Yves Chibon |
65d1e3 |
'issue_comments', 'notification',
|
|
Pierre-Yves Chibon |
65d1e3 |
nullable=False, existing_nullable=True)
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
|
|
Pierre-Yves Chibon |
65d1e3 |
def downgrade():
|
|
Pierre-Yves Chibon |
65d1e3 |
''' Remove the column notification from the table issue_comments.
|
|
Pierre-Yves Chibon |
65d1e3 |
'''
|
|
Pierre-Yves Chibon |
65d1e3 |
op.drop_column('issue_comments', 'notification')
|