ensure that new column has default, which is needed for postgres (#2038)

Co-authored-by: burnettk <burnettk@users.noreply.github.com>
This commit is contained in:
Kevin Burnett 2024-08-08 14:58:31 +00:00 committed by GitHub
parent 76e671cbd6
commit c6134d3024
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('group', schema=None) as batch_op:
batch_op.add_column(sa.Column('source_is_open_id', sa.Boolean(), nullable=False))
batch_op.add_column(sa.Column('source_is_open_id', sa.Boolean(), server_default=sa.text('false'), nullable=False))
batch_op.create_index(batch_op.f('ix_group_source_is_open_id'), ['source_is_open_id'], unique=False)
with op.batch_alter_table('human_task_user', schema=None) as batch_op:

View File

@ -4,6 +4,7 @@ from dataclasses import dataclass
from typing import TYPE_CHECKING
from sqlalchemy.orm import relationship
from sqlalchemy.sql import false
from spiffworkflow_backend.models.db import SpiffworkflowBaseDBModel
from spiffworkflow_backend.models.db import db
@ -30,7 +31,7 @@ class GroupModel(SpiffworkflowBaseDBModel):
id = db.Column(db.Integer, primary_key=True)
name: str = db.Column(db.String(255), index=True)
identifier: str = db.Column(db.String(255), index=True)
source_is_open_id: bool = db.Column(db.Boolean, default=False, nullable=False, index=True)
source_is_open_id: bool = db.Column(db.Boolean, default=False, server_default=false(), nullable=False, index=True)
user_group_assignments = relationship("UserGroupAssignmentModel", cascade="delete")
user_group_assignments_waiting = relationship("UserGroupAssignmentWaitingModel", cascade="delete") # type: ignore