Blame alembic/versions/770149d96e24_nullable_project_for_api_token.py

Pierre-Yves Chibon 1e5d3a
"""nullable project for api token
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
Revision ID: 770149d96e24
Vivek Anand 09b690
Revises: 11470abae0d6
Pierre-Yves Chibon 1e5d3a
Create Date: 2017-03-04 18:05:07.956057
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
"""
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
# revision identifiers, used by Alembic.
Pierre-Yves Chibon 1e5d3a
revision = '770149d96e24'
Vivek Anand 09b690
down_revision = '11470abae0d6'
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
from alembic import op
Pierre-Yves Chibon 1e5d3a
import sqlalchemy as sa
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
def upgrade():
Pierre-Yves Chibon 1e5d3a
    """ Make the field 'project_id' of the table tokens be nullable. """
Pierre-Yves Chibon 1e5d3a
    op.alter_column(
Pierre-Yves Chibon 1e5d3a
        'tokens',
Pierre-Yves Chibon 1e5d3a
        'project_id',
Pierre-Yves Chibon 1e5d3a
        nullable=True,
Pierre-Yves Chibon 1e5d3a
        existing_nullable=False,
Pierre-Yves Chibon 1e5d3a
    )
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
Pierre-Yves Chibon 1e5d3a
def downgrade():
Pierre-Yves Chibon 1e5d3a
    """ Make the field 'project_id' of the table tokens be not nullable.
Pierre-Yves Chibon 1e5d3a
    """
Pierre-Yves Chibon 1e5d3a
    op.alter_column(
Pierre-Yves Chibon 1e5d3a
        'tokens',
Pierre-Yves Chibon 1e5d3a
        'project_id',
Pierre-Yves Chibon 1e5d3a
        nullable=False,
Pierre-Yves Chibon 1e5d3a
        existing_nullable=True,
Pierre-Yves Chibon 1e5d3a
    )