Skip to content

Commit

Permalink
change Session.state column to not nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanmcreynolds committed Jul 10, 2023
1 parent 94a4d86 commit 4d88344
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tiled/authn_database/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Session(Timestamped, Base):
principal_id = Column(Integer, ForeignKey("principals.id"), nullable=False)
revoked = Column(Boolean, default=False, nullable=False)
# State allows for custom authenticator information to be stored in the session.
state = Column(JSONVariant, nullable=True)
state = Column(JSONVariant, nullable=False)
principal = relationship("Principal", back_populates="sessions", lazy="joined")


Expand Down
2 changes: 1 addition & 1 deletion tiled/server/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ async def create_session(
session = orm.Session(
principal_id=principal.id,
expiration_time=utcnow() + settings.session_max_age,
state=state,
state=state or {},
)
db.add(session)
await db.commit()
Expand Down

0 comments on commit 4d88344

Please sign in to comment.