2016-04-18 18:44:39 +00:00
|
|
|
from sqlalchemy import Column, Integer, DateTime, String, PickleType, ForeignKey
|
|
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from szurubooru.db.base import Base
|
|
|
|
|
|
|
|
class Snapshot(Base):
|
|
|
|
__tablename__ = 'snapshot'
|
|
|
|
|
2016-04-21 16:59:44 +00:00
|
|
|
OPERATION_CREATED = 'created'
|
2016-04-18 18:44:39 +00:00
|
|
|
OPERATION_MODIFIED = 'modified'
|
|
|
|
OPERATION_DELETED = 'deleted'
|
|
|
|
|
|
|
|
snapshot_id = Column('id', Integer, primary_key=True)
|
|
|
|
creation_time = Column('creation_time', DateTime, nullable=False)
|
|
|
|
resource_type = Column('resource_type', String(32), nullable=False)
|
|
|
|
resource_id = Column('resource_id', Integer, nullable=False)
|
2016-04-21 16:59:44 +00:00
|
|
|
resource_repr = Column('resource_repr', String(64), nullable=False)
|
2016-04-18 18:44:39 +00:00
|
|
|
operation = Column('operation', String(16), nullable=False)
|
|
|
|
user_id = Column('user_id', Integer, ForeignKey('user.id'))
|
|
|
|
data = Column('data', PickleType)
|
|
|
|
|
|
|
|
user = relationship('User')
|