1
0
forked from ScoDoc/ScoDoc
ScoDoc/migrations/versions/cf29790ca6f6_ajout_prenom_civilite__etat_civil.py

47 lines
1.2 KiB
Python

"""ajout (prenom,civilite)_etat_civil
Revision ID: cf29790ca6f6
Revises: 6520faf67508
Create Date: 2023-02-25 10:55:42.831526
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "cf29790ca6f6"
down_revision = "6520faf67508"
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("identite", schema=None) as batch_op:
batch_op.add_column(
sa.Column(
"civilite_etat_civil",
sa.String(length=1),
server_default="X",
nullable=False,
)
)
batch_op.add_column(
sa.Column("prenom_etat_civil", sa.Text(), server_default="", nullable=False)
)
batch_op.create_check_constraint(
"identite_civ_etat_civ_check",
"civilite_etat_civil IN ('M', 'F', 'X')",
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table("identite", schema=None) as batch_op:
batch_op.drop_column("prenom_etat_civil")
batch_op.drop_column("civilite_etat_civil")