forked from edward/owl-map
Add EditSession table
This commit is contained in:
parent
c563d440fc
commit
b03ae32a9e
|
@ -300,6 +300,17 @@ class User(Base, UserMixin):
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
return self.active
|
return self.active
|
||||||
|
|
||||||
|
class EditSession(Base):
|
||||||
|
__tablename__ = 'edit_session'
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
user_id = Column(Integer, ForeignKey(User.id))
|
||||||
|
created = Column(DateTime, default=now_utc(), nullable=False)
|
||||||
|
edit_list = Column(postgresql.JSONB)
|
||||||
|
comment = Column(String)
|
||||||
|
|
||||||
|
user = relationship('User')
|
||||||
|
changeset = relationship('Changeset', back_populates='edit_session', uselist=False)
|
||||||
|
|
||||||
|
|
||||||
class Changeset(Base):
|
class Changeset(Base):
|
||||||
__tablename__ = 'changeset'
|
__tablename__ = 'changeset'
|
||||||
|
@ -308,12 +319,15 @@ class Changeset(Base):
|
||||||
comment = Column(String)
|
comment = Column(String)
|
||||||
user_id = Column(Integer, ForeignKey(User.id))
|
user_id = Column(Integer, ForeignKey(User.id))
|
||||||
update_count = Column(Integer, nullable=False)
|
update_count = Column(Integer, nullable=False)
|
||||||
|
edit_session_id = Column(Integer, ForeignKey(EditSession.id))
|
||||||
|
|
||||||
user = relationship('User',
|
user = relationship('User',
|
||||||
backref=backref('changesets',
|
backref=backref('changesets',
|
||||||
lazy='dynamic',
|
lazy='dynamic',
|
||||||
order_by='Changeset.created.desc()'))
|
order_by='Changeset.created.desc()'))
|
||||||
|
|
||||||
|
edit_session = relationship('EditSession', back_populates='changeset')
|
||||||
|
|
||||||
|
|
||||||
class ChangesetEdit(Base):
|
class ChangesetEdit(Base):
|
||||||
__tablename__ = 'changeset_edit'
|
__tablename__ = 'changeset_edit'
|
||||||
|
|
Loading…
Reference in a new issue