ScoDoc/migrations/versions/5542cac8c34a_semset_periode.py

39 lines
913 B
Python

"""semset_periode
Revision ID: 5542cac8c34a
Revises: 52f5f35c077f
Create Date: 2022-11-08 01:17:51.983042
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker # added by ev
# revision identifiers, used by Alembic.
revision = "5542cac8c34a"
down_revision = "52f5f35c077f"
branch_labels = None
depends_on = None
Session = sessionmaker()
def upgrade():
#
bind = op.get_bind()
session = Session(bind=bind)
session.execute(
sa.text("""UPDATE notes_semset SET sem_id=0 WHERE sem_id IS NULL;""")
)
op.alter_column(
"notes_semset", "sem_id", existing_type=sa.INTEGER(), nullable=False
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column("notes_semset", "sem_id", existing_type=sa.INTEGER(), nullable=True)
# ### end Alembic commands ###