db.model: Add had_created.

I note that newer users, you see the actual creation time, but for older
users, this is reported as 0.  So, store the value as-given, rather than
fudging it.  `created` will now reflect when we first saw the user.
This commit is contained in:
Stuart Longland 2018-06-02 13:13:17 +10:00
parent 40ad79dd3d
commit c2b500a8a5
Signed by: stuartl
GPG Key ID: 6AA32EFB18079BAA

View File

@ -1,7 +1,7 @@
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import Column, BigInteger, String, ForeignKey, \
Boolean, LargeBinary, Text, DateTime, Table, Integer
LargeBinary, Text, DateTime, Table, Integer
from sqlalchemy.dialects.postgresql import UUID
Base = declarative_base()
@ -30,6 +30,7 @@ class User(Base):
url = Column(String)
avatar_id = Column(BigInteger, ForeignKey('avatar.avatar_id'))
created = Column(DateTime(timezone=True))
had_created = Column(DateTime(timezone=True))
last_update = Column(DateTime(timezone=True))
sessions = relationship("Session", back_populates="user",