joining table allocation to actifs

This commit is contained in:
2023-01-29 18:11:40 +01:00
parent 4a55f94551
commit f8023701a4
14 changed files with 111 additions and 272 deletions

View File

@@ -0,0 +1,42 @@
"""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 ###