15 lines
521 B
Python
15 lines
521 B
Python
from sqlalchemy import Column, DateTime, String
|
|
from sqlalchemy.orm import relationship
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base_class import Base
|
|
|
|
|
|
class Tag(Base):
|
|
id = Column(String, primary_key=True, index=True)
|
|
name = Column(String, index=True, nullable=False)
|
|
color = Column(String, nullable=True, default="#FFFFFF")
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
# Relationships
|
|
notes = relationship("Note", secondary="notetag", back_populates="tags") |