2025-05-18 05:21:16 -05:00

15 lines
546 B
Python

from app import db
from datetime import datetime
class GrowLog(db.Model):
__tablename__ = 'grow_logs'
id = db.Column(db.Integer, primary_key=True)
plant_id = db.Column(db.Integer, db.ForeignKey('plants.id'), nullable=False)
timestamp = db.Column(db.DateTime, default=datetime.utcnow)
event_type = db.Column(db.String(64), nullable=False)
note = db.Column(db.Text)
media = db.relationship("Media", backref="growlog", lazy=True)
def __repr__(self):
return f"<GrowLog {self.event_type} @ {self.timestamp}>"