diff --git a/funnel/models/comment.py b/funnel/models/comment.py index fff72671b..25ec784d3 100644 --- a/funnel/models/comment.py +++ b/funnel/models/comment.py @@ -87,7 +87,7 @@ class Commentset(UuidMixin, BaseMixin[int, Account], Model): _state: Mapped[int] = sa_orm.mapped_column( 'state', sa.SmallInteger, - StateManager.check_constraint('state', COMMENTSET_STATE), + StateManager.check_constraint('state', COMMENTSET_STATE, sa.SmallInteger), nullable=False, default=COMMENTSET_STATE.OPEN, ) @@ -328,7 +328,7 @@ class Comment(UuidMixin, BaseMixin[int, Account], Model): _state: Mapped[int] = sa_orm.mapped_column( 'state', - StateManager.check_constraint('state', COMMENT_STATE), + StateManager.check_constraint('state', COMMENT_STATE, sa.Integer), default=COMMENT_STATE.SUBMITTED, nullable=False, ) diff --git a/funnel/models/email_address.py b/funnel/models/email_address.py index 14e88a3c6..2a14e0d2e 100644 --- a/funnel/models/email_address.py +++ b/funnel/models/email_address.py @@ -234,6 +234,7 @@ class methods, depending on whether the email address is linked to an owner or n StateManager.check_constraint( 'delivery_state', EMAIL_DELIVERY_STATE, + sa.Integer, name='email_address_delivery_state_check', ), nullable=False, diff --git a/funnel/models/moderation.py b/funnel/models/moderation.py index e0ea6132e..08cd28e53 100644 --- a/funnel/models/moderation.py +++ b/funnel/models/moderation.py @@ -35,7 +35,9 @@ class CommentModeratorReport(UuidMixin, BaseMixin[UUID, Account], Model): reported_by: Mapped[Account] = relationship(back_populates='moderator_reports') report_type: Mapped[int] = sa_orm.mapped_column( sa.SmallInteger, - StateManager.check_constraint('report_type', MODERATOR_REPORT_TYPE), + StateManager.check_constraint( + 'report_type', MODERATOR_REPORT_TYPE, sa.SmallInteger + ), nullable=False, default=MODERATOR_REPORT_TYPE.SPAM, ) diff --git a/funnel/models/project.py b/funnel/models/project.py index 6889dbf98..a5008db7e 100644 --- a/funnel/models/project.py +++ b/funnel/models/project.py @@ -154,7 +154,7 @@ class Project(UuidMixin, BaseScopedNameMixin[int, Account], Model): _state: Mapped[int] = sa_orm.mapped_column( 'state', - StateManager.check_constraint('state', PROJECT_STATE), + StateManager.check_constraint('state', PROJECT_STATE, sa.Integer), default=PROJECT_STATE.DRAFT, nullable=False, index=True, @@ -165,7 +165,7 @@ class Project(UuidMixin, BaseScopedNameMixin[int, Account], Model): ) _cfp_state: Mapped[int] = sa_orm.mapped_column( 'cfp_state', - StateManager.check_constraint('cfp_state', CFP_STATE), + StateManager.check_constraint('cfp_state', CFP_STATE, sa.Integer), default=CFP_STATE.NONE, nullable=False, index=True, diff --git a/funnel/models/proposal.py b/funnel/models/proposal.py index eaa0fe07d..ba1f8374c 100644 --- a/funnel/models/proposal.py +++ b/funnel/models/proposal.py @@ -162,7 +162,7 @@ class Proposal(UuidMixin, BaseScopedIdNameMixin, VideoMixin, ReorderMixin, Model _state: Mapped[int] = sa_orm.mapped_column( 'state', - StateManager.check_constraint('state', PROPOSAL_STATE), + StateManager.check_constraint('state', PROPOSAL_STATE, sa.Integer), default=PROPOSAL_STATE.SUBMITTED, nullable=False, ) diff --git a/funnel/models/rsvp.py b/funnel/models/rsvp.py index 9480391b2..00bbc11f7 100644 --- a/funnel/models/rsvp.py +++ b/funnel/models/rsvp.py @@ -68,7 +68,7 @@ class Rsvp(UuidMixin, NoIdMixin, Model): _state: Mapped[str] = sa_orm.mapped_column( 'state', sa.CHAR(1), - StateManager.check_constraint('state', RSVP_STATUS), + StateManager.check_constraint('state', RSVP_STATUS, sa.CHAR(1)), default=RSVP_STATUS.AWAITING, nullable=False, ) diff --git a/funnel/models/update.py b/funnel/models/update.py index 3f471c396..7aca005c5 100644 --- a/funnel/models/update.py +++ b/funnel/models/update.py @@ -51,7 +51,9 @@ class Update(UuidMixin, BaseScopedIdNameMixin[int, Account], Model): _visibility_state: Mapped[int] = sa_orm.mapped_column( 'visibility_state', sa.SmallInteger, - StateManager.check_constraint('visibility_state', VISIBILITY_STATE), + StateManager.check_constraint( + 'visibility_state', VISIBILITY_STATE, sa.SmallInteger + ), default=VISIBILITY_STATE.PUBLIC, nullable=False, index=True, @@ -63,7 +65,7 @@ class Update(UuidMixin, BaseScopedIdNameMixin[int, Account], Model): _state: Mapped[int] = sa_orm.mapped_column( 'state', sa.SmallInteger, - StateManager.check_constraint('state', UPDATE_STATE), + StateManager.check_constraint('state', UPDATE_STATE, sa.SmallInteger), default=UPDATE_STATE.DRAFT, nullable=False, index=True,