Blame alembic/versions/349a3890596_increase_length_group_name.py

Pierre-Yves Chibon c2701e
"""Increase length group name
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
Revision ID: 349a3890596
Pierre-Yves Chibon c2701e
Revises: 5083efccac7
Pierre-Yves Chibon c2701e
Create Date: 2016-11-30 14:30:15.681269
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
"""
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
# revision identifiers, used by Alembic.
Pierre-Yves Chibon c2701e
revision = '349a3890596'
Pierre-Yves Chibon c2701e
down_revision = '5083efccac7'
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
from alembic import op
Pierre-Yves Chibon c2701e
import sqlalchemy as sa
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
def upgrade():
Pierre-Yves Chibon c2701e
    ''' Increase the length of group_name to 255 characters instead of 16.
Pierre-Yves Chibon c2701e
    '''
Pierre-Yves Chibon c2701e
    op.alter_column(
Pierre-Yves Chibon c2701e
        'pagure_group', 'group_name',
Pierre-Yves Chibon c2701e
        type_=sa.String(255),
Pierre-Yves Chibon c2701e
        existing_type=sa.String(16)
Pierre-Yves Chibon c2701e
    )
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
Pierre-Yves Chibon c2701e
def downgrade():
Pierre-Yves Chibon c2701e
    ''' Decrease the length of group_name to 16 characters instead of 255.
Pierre-Yves Chibon c2701e
    '''
Pierre-Yves Chibon c2701e
    op.alter_column(
Pierre-Yves Chibon c2701e
        'pagure_group', 'group_name',
Pierre-Yves Chibon c2701e
        type_=sa.String(16),
Pierre-Yves Chibon c2701e
        existing_type=sa.String(255)
Pierre-Yves Chibon c2701e
    )