From 560b18b5c4ff9c2c143a17d2dcf92b0aeadf81db Mon Sep 17 00:00:00 2001 From: Oscar Krause Date: Tue, 27 Dec 2022 19:57:58 +0100 Subject: [PATCH] orm.py - fixed not null column --- app/orm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/orm.py b/app/orm.py index bb806ae..7982b84 100644 --- a/app/orm.py +++ b/app/orm.py @@ -68,6 +68,8 @@ class Lease(Base): session = sessionmaker(autocommit=True, autoflush=True, bind=engine)() entity = session.query(Lease).filter(and_(Lease.origin_ref == lease.origin_ref, Lease.lease_ref == lease.lease_ref)).first() if entity is None: + if lease.lease_updated is None: + lease.lease_updated = lease.lease_created session.add(lease) else: values = dict(lease_expires=lease.lease_expires, lease_updated=lease.lease_updated)