init
This commit is contained in:
17
new-planet-backend/app/models/schedule.py
Normal file
17
new-planet-backend/app/models/schedule.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from sqlalchemy import Column, String, Date, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from app.db.base import BaseModel
|
||||
|
||||
|
||||
class Schedule(BaseModel):
|
||||
__tablename__ = "schedules"
|
||||
|
||||
user_id = Column(String, ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True)
|
||||
title = Column(String(255), nullable=False)
|
||||
date = Column(Date, nullable=False, index=True)
|
||||
description = Column(String(1000), nullable=True)
|
||||
|
||||
# Relationships
|
||||
user = relationship("User", back_populates="schedules")
|
||||
tasks = relationship("Task", back_populates="schedule", cascade="all, delete-orphan", order_by="Task.order")
|
||||
|
||||
Reference in New Issue
Block a user