"""Defailt list

Revision ID: 74385c7d3bea
Revises: 45675fa62aa2
Create Date: 2023-01-20 17:52:20.778831

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '74385c7d3bea'
down_revision = '45675fa62aa2'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('cmf_list', sa.Column('is_default_list', sa.Boolean(), nullable=True))
    op.add_column('cmf_project', sa.Column('default_list_id', sa.String(length=64), nullable=True))
    op.create_index(op.f('ix_cmf_project_default_list_id'), 'cmf_project', ['default_list_id'], unique=False)
    op.create_foreign_key(None, 'cmf_project', 'cmf_list', ['default_list_id'], ['id'])
    op.add_column('cmf_role', sa.Column('structural_project_id', sa.String(length=64), nullable=True))
    op.create_index(op.f('ix_cmf_role_structural_project_id'), 'cmf_role', ['structural_project_id'], unique=False)
    op.create_foreign_key(None, 'cmf_role', 'cmf_project', ['structural_project_id'], ['id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'cmf_role', type_='foreignkey')
    op.drop_index(op.f('ix_cmf_role_structural_project_id'), table_name='cmf_role')
    op.drop_column('cmf_role', 'structural_project_id')
    op.drop_constraint(None, 'cmf_project', type_='foreignkey')
    op.drop_index(op.f('ix_cmf_project_default_list_id'), table_name='cmf_project')
    op.drop_column('cmf_project', 'default_list_id')
    op.drop_column('cmf_list', 'is_default_list')
    # ### end Alembic commands ###
