DocScoDoc/migrations/versions/0b337376e9f7_ajout_taxe_apprentissage_association_.py

77 lines
2.6 KiB
Python
Raw Normal View History

"""ajout taxe apprentissage, association, changement historique
Revision ID: 0b337376e9f7
Revises: ee21c76c8183
Create Date: 2022-07-04 21:10:53.946385
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
2022-07-07 16:39:27 +02:00
revision = "0b337376e9f7"
down_revision = "ee21c76c8183"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
2022-07-07 16:39:27 +02:00
op.create_table(
"are_historique",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column(
"date",
sa.DateTime(timezone=True),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column("authenticated_user", sa.Text(), nullable=True),
sa.Column("entreprise_id", sa.Integer(), nullable=True),
sa.Column("object", sa.Text(), nullable=True),
sa.Column("object_id", sa.Integer(), nullable=True),
sa.Column("text", sa.Text(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
2022-07-07 16:39:27 +02:00
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.drop_table("are_logs")
op.add_column(
"are_entreprises", sa.Column("association", sa.Boolean(), nullable=True)
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
2022-07-07 16:39:27 +02:00
op.drop_column("are_entreprises", "association")
op.create_table(
"are_logs",
sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False),
sa.Column(
"date",
postgresql.TIMESTAMP(timezone=True),
server_default=sa.text("now()"),
autoincrement=False,
nullable=True,
),
sa.Column("authenticated_user", sa.TEXT(), autoincrement=False, nullable=True),
sa.Column("object", sa.INTEGER(), autoincrement=False, nullable=True),
sa.Column("text", sa.TEXT(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint("id", name="are_logs_pkey"),
)
2022-07-07 16:39:27 +02:00
op.drop_table("are_taxe_apprentissage")
op.drop_table("are_historique")
# ### end Alembic commands ###