forked from ScoDoc/ScoDoc
b73a02ac67
- trace justificatifs - migrer entry_date - calcul des assiduités justifiées - ajout colonnes user_id et est_just - bug fix timezone max - remise à zero séquence, cmd downgrade assiduite (si dept none ) - API : filtrage par user_id et par est_just WIP
72 lines
1.9 KiB
Python
72 lines
1.9 KiB
Python
"""assiduites ajout user_id,est_just
|
|
|
|
Revision ID: b555390780b2
|
|
Revises: dbcf2175e87f
|
|
Create Date: 2023-02-22 18:44:22.643275
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "b555390780b2"
|
|
down_revision = "dbcf2175e87f"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column(
|
|
"assiduites",
|
|
sa.Column(
|
|
"user_id",
|
|
sa.Integer(),
|
|
nullable=True,
|
|
),
|
|
)
|
|
op.add_column(
|
|
"assiduites",
|
|
sa.Column("est_just", sa.Boolean(), server_default="false", nullable=False),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_assiduites_user_id"), "assiduites", ["user_id"], unique=False
|
|
)
|
|
op.create_foreign_key(
|
|
"fk_assiduites_user_id",
|
|
"assiduites",
|
|
"user",
|
|
["user_id"],
|
|
["id"],
|
|
ondelete="SET NULL",
|
|
)
|
|
op.add_column(
|
|
"justificatifs",
|
|
sa.Column("user_id", sa.Integer(), nullable=True),
|
|
)
|
|
op.create_index(
|
|
op.f("ix_justificatifs_user_id"), "justificatifs", ["user_id"], unique=False
|
|
)
|
|
op.create_foreign_key(
|
|
"fk_justificatifs_user_id",
|
|
"justificatifs",
|
|
"user",
|
|
["user_id"],
|
|
["id"],
|
|
ondelete="SET NULL",
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_constraint("fk_justificatifs_user_id", "justificatifs", type_="foreignkey")
|
|
op.drop_index(op.f("ix_justificatifs_user_id"), table_name="justificatifs")
|
|
op.drop_column("justificatifs", "user_id")
|
|
op.drop_constraint("fk_assiduites_user_id", "assiduites", type_="foreignkey")
|
|
op.drop_index(op.f("ix_assiduites_user_id"), table_name="assiduites")
|
|
op.drop_column("assiduites", "est_just")
|
|
op.drop_column("assiduites", "user_id")
|
|
# ### end Alembic commands ###
|