1
0
forked from ScoDoc/ScoDoc

taxe apprentissage, changement historique, association

This commit is contained in:
Arthur ZHU 2022-05-06 18:50:56 +02:00
parent e34ae9b3ec
commit 259b2a449d

View File

@ -0,0 +1,79 @@
"""ajout taxe apprentissage, association, changement historique
Revision ID: 2b872cb116ca
Revises: d5b3bdd1d622
Create Date: 2022-05-06 18:16:58.727052
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "2b872cb116ca"
down_revision = "d5b3bdd1d622"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"are_taxe_apprentissage",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("entreprise_id", sa.Integer(), nullable=True),
sa.Column("annee", sa.Integer(), nullable=True),
sa.Column("montant", sa.Integer(), nullable=True),
sa.Column("notes", sa.Text(), nullable=True),
sa.ForeignKeyConstraint(
["entreprise_id"], ["are_entreprises.id"], ondelete="cascade"
),
sa.PrimaryKeyConstraint("id"),
)
op.add_column(
"are_entreprises", sa.Column("association", sa.Boolean(), nullable=True)
)
op.add_column("are_logs", sa.Column("entreprise_id", sa.Integer(), nullable=True))
op.add_column("are_logs", sa.Column("object_id", sa.Integer(), nullable=True))
op.alter_column(
"are_logs",
"object",
existing_type=sa.INTEGER(),
type_=sa.Text(),
existing_nullable=True,
)
op.create_index(
op.f("ix_scolar_news_authenticated_user"),
"scolar_news",
["authenticated_user"],
unique=False,
)
op.create_index(op.f("ix_scolar_news_date"), "scolar_news", ["date"], unique=False)
op.create_index(
op.f("ix_scolar_news_object"), "scolar_news", ["object"], unique=False
)
op.create_index(op.f("ix_scolar_news_type"), "scolar_news", ["type"], unique=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_scolar_news_type"), table_name="scolar_news")
op.drop_index(op.f("ix_scolar_news_object"), table_name="scolar_news")
op.drop_index(op.f("ix_scolar_news_date"), table_name="scolar_news")
op.drop_index(op.f("ix_scolar_news_authenticated_user"), table_name="scolar_news")
op.execute(
"alter table are_logs alter column object set data type int using object::integer"
)
op.alter_column(
"are_logs",
"object",
existing_type=sa.Text(),
type_=sa.INTEGER(),
existing_nullable=True,
)
op.drop_column("are_logs", "object_id")
op.drop_column("are_logs", "entreprise_id")
op.drop_column("are_entreprises", "association")
op.drop_table("are_taxe_apprentissage")
# ### end Alembic commands ###