Files
ctp_blogr/cao_blogr/alembic/versions/20230129_b8f8216d72c7.py

43 lines
1.5 KiB
Python

"""added foreign key to allocation
Revision ID: b8f8216d72c7
Revises:
Create Date: 2023-01-29 12:20:48.097107
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b8f8216d72c7'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('allocation',
sa.Column('no_cat', sa.Integer(), nullable=False),
sa.Column('classe', sa.Unicode(length=45), nullable=True),
sa.Column('pc_cible', sa.Integer(), nullable=True),
sa.Column('pc_atteint', sa.Float(), nullable=True),
sa.Column('pc_ecart', sa.Float(), nullable=True),
sa.Column('valeur', sa.Float(), nullable=True),
sa.Column('type', sa.Unicode(length=45), nullable=True),
sa.Column('ordre', sa.Integer(), nullable=True),
sa.Column('bg_color', sa.Unicode(length=45), nullable=True),
sa.ForeignKeyConstraint(['classe'], ['actifs.classe'], name=op.f('fk_allocation_classe_actifs')),
sa.PrimaryKeyConstraint('no_cat', name=op.f('pk_allocation'))
)
op.create_index('classe_index', 'allocation', ['classe'], unique=False)
op.create_index('ordre_index', 'allocation', ['ordre'], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index('ordre_index', table_name='allocation')
op.drop_index('classe_index', table_name='allocation')
op.drop_table('allocation')
# ### end Alembic commands ###