Blame alembic/versions/496f7a700f2e_add_priorities.py

Pierre-Yves Chibon 36fb65
"""Add priorities
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
Revision ID: 496f7a700f2e
Pierre-Yves Chibon 36fb65
Revises: 4cae55a80a42
Pierre-Yves Chibon 36fb65
Create Date: 2016-03-24 12:19:34.298752
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
"""
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
# revision identifiers, used by Alembic.
Pierre-Yves Chibon 36fb65
revision = '496f7a700f2e'
Pierre-Yves Chibon 36fb65
down_revision = '4cae55a80a42'
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
from alembic import op
Pierre-Yves Chibon 36fb65
import sqlalchemy as sa
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
def upgrade():
Pierre-Yves Chibon 36fb65
    ''' Add the column _priorities to the table projects
Pierre-Yves Chibon 36fb65
    and the column priority to the table issues.
Pierre-Yves Chibon 36fb65
    '''
Pierre-Yves Chibon 36fb65
    op.add_column(
Pierre-Yves Chibon 36fb65
        'projects',
Pierre-Yves Chibon 36fb65
        sa.Column('_priorities', sa.Text, nullable=True)
Pierre-Yves Chibon 36fb65
    )
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
    op.add_column(
Pierre-Yves Chibon 36fb65
        'issues',
Pierre-Yves Chibon 36fb65
        sa.Column('priority', sa.Integer, nullable=True, default=None)
Pierre-Yves Chibon 36fb65
    )
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
Pierre-Yves Chibon 36fb65
def downgrade():
Pierre-Yves Chibon 36fb65
    ''' Drop the column _priorities from the table projects
Pierre-Yves Chibon 36fb65
    and the column priority from the table issues.
Pierre-Yves Chibon 36fb65
    '''
Pierre-Yves Chibon 36fb65
    op.drop_column('projects', '_priorities')
Pierre-Yves Chibon 36fb65
    op.drop_column('issues', 'priority')