mirror of
https://github.com/sstent/AICyclingCoach.git
synced 2026-02-04 05:21:47 +00:00
sync
This commit is contained in:
@@ -11,5 +11,6 @@ class Plan(BaseModel):
|
||||
parent_plan_id = Column(Integer, ForeignKey('plans.id'), nullable=True)
|
||||
|
||||
parent_plan = relationship("Plan", remote_side="Plan.id", backref="child_plans")
|
||||
analyses = relationship("Analysis", back_populates="plan")
|
||||
workouts = relationship("Workout", back_populates="plan", cascade="all, delete-orphan")
|
||||
analyses = relationship("Analysis", back_populates="plan", lazy="selectin")
|
||||
workouts = relationship("Workout", back_populates="plan", cascade="all, delete-orphan", lazy="selectin")
|
||||
rules = relationship("Rule", secondary="plan_rules", back_populates="plans", lazy="selectin")
|
||||
@@ -1,5 +1,4 @@
|
||||
from sqlalchemy import Column, Integer, ForeignKey, Boolean, String
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy import Column, Integer, ForeignKey, Boolean, String, Text
|
||||
from sqlalchemy.orm import relationship
|
||||
from .base import BaseModel
|
||||
|
||||
@@ -7,9 +6,11 @@ class Rule(BaseModel):
|
||||
__tablename__ = "rules"
|
||||
|
||||
name = Column(String(100), nullable=False)
|
||||
description = Column(Text, nullable=True)
|
||||
user_defined = Column(Boolean, default=True)
|
||||
jsonb_rules = Column(JSONB, nullable=False)
|
||||
rule_text = Column(Text, nullable=False) # Plaintext rules as per design spec
|
||||
version = Column(Integer, default=1)
|
||||
parent_rule_id = Column(Integer, ForeignKey('rules.id'), nullable=True)
|
||||
|
||||
parent_rule = relationship("Rule", remote_side="Rule.id")
|
||||
parent_rule = relationship("Rule", remote_side="Rule.id")
|
||||
plans = relationship("Plan", secondary="plan_rules", back_populates="rules", lazy="selectin")
|
||||
Reference in New Issue
Block a user