ship 1.0
This commit is contained in:
parent
e10ff6b2c5
commit
f75283b1a2
@ -1,7 +1,6 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Unicode, DECIMAL, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
import uuid
|
||||
|
||||
|
||||
@ -19,6 +18,9 @@ class PhotoSet(Base):
|
||||
|
||||
files = relationship("Photo", back_populates="set")
|
||||
|
||||
title = Column(String)
|
||||
description = Column(String)
|
||||
|
||||
|
||||
class Photo(Base):
|
||||
__tablename__ = 'files'
|
||||
@ -36,3 +38,29 @@ class Photo(Base):
|
||||
hash = Column(String(length=64), unique=True)
|
||||
path = Column(Unicode)
|
||||
format = Column(String(length=64)) # TODO how long can a mime string be
|
||||
|
||||
|
||||
class Tag(Base):
|
||||
__tablename__ = 'tags'
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
uuid = Column(Unicode, default=lambda: str(uuid.uuid4()))
|
||||
created = Column(DateTime)
|
||||
modified = Column(DateTime)
|
||||
title = Column(String)
|
||||
slug = Column(String)
|
||||
description = Column(String)
|
||||
|
||||
entries = relationship("TagItem", back_populates="tag")
|
||||
|
||||
|
||||
class TagItem(Base):
|
||||
__tablename__ = 'tag_items'
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
tag_id = Column(Integer, ForeignKey("tags.id"))
|
||||
|
||||
tag = relationship("Tag", back_populates="entries", foreign_keys=[tag_id])
|
||||
|
||||
item_uuid = Column(String, unique=True)
|
||||
order = Column(Integer, default=0)
|
||||
|
Loading…
Reference in New Issue
Block a user