Add backend/app/models/record.py
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
"""Record model."""
|
||||||
|
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, Text
|
||||||
|
from sqlalchemy.orm import relationship
|
||||||
|
from datetime import datetime
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
class Record(Base):
|
||||||
|
"""Record model."""
|
||||||
|
__tablename__ = "records"
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
column_id = Column(Integer, ForeignKey("columns.id"), nullable=False)
|
||||||
|
row_id = Column(Integer, nullable=False)
|
||||||
|
value = Column(Text)
|
||||||
|
created_at = Column(DateTime, default=datetime.utcnow)
|
||||||
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||||
|
|
||||||
|
column = relationship("Column", back_populates="records")
|
||||||
Reference in New Issue
Block a user