|
|
@@ -58,13 +58,13 @@ class Project(Base):
|
|
|
)
|
|
|
is_public: Mapped[bool] = mapped_column(Boolean())
|
|
|
volunteers: Mapped[list["Volunteer"]] = relationship(
|
|
|
- back_populates="project", cascade="delete-orphan"
|
|
|
+ back_populates="project", cascade="delete, delete-orphan"
|
|
|
)
|
|
|
slots: Mapped[list["Slot"]] = relationship(
|
|
|
- back_populates="project", cascade="delete-orphan"
|
|
|
+ back_populates="project", cascade="delete, delete-orphan"
|
|
|
)
|
|
|
sms: Mapped[list["Sms"]] = relationship(
|
|
|
- back_populates="project", cascade="delete-orphan"
|
|
|
+ back_populates="project", cascade="delete, delete-orphan"
|
|
|
)
|
|
|
|
|
|
|
|
|
@@ -94,7 +94,7 @@ class Volunteer(Base):
|
|
|
DateTime(timezone=True), default=datetime.now, onupdate=func.now()
|
|
|
)
|
|
|
name: Mapped[str] = mapped_column(String(128))
|
|
|
- surname: Mapped[str] = mapped_column(String(128))
|
|
|
+ surname: Mapped[str] = mapped_column(String(128), nullable=True)
|
|
|
email: Mapped[str] = mapped_column(String(128))
|
|
|
phone_number: Mapped[str] = mapped_column(String(128))
|
|
|
automatic_sms: Mapped[bool] = mapped_column(Boolean(), default=False)
|
|
|
@@ -146,18 +146,18 @@ class Sms(Base):
|
|
|
)
|
|
|
project: Mapped["Project"] = relationship(back_populates="sms")
|
|
|
|
|
|
- volunteer_id: Mapped[str] = mapped_column(ForeignKey("volunteers.id"))
|
|
|
+ volunteer_id: Mapped[str] = mapped_column(
|
|
|
+ ForeignKey("volunteers.id"), nullable=True
|
|
|
+ )
|
|
|
created_at: Mapped[datetime] = mapped_column(
|
|
|
DateTime(timezone=True), server_default=func.now()
|
|
|
)
|
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
|
DateTime(timezone=True), default=datetime.now, onupdate=func.now()
|
|
|
)
|
|
|
- content: Mapped[str] = mapped_column(
|
|
|
- String(), nullable=False, unique=True, index=True
|
|
|
- )
|
|
|
+ content: Mapped[str] = mapped_column(String(), nullable=False)
|
|
|
phone_number: Mapped[str] = mapped_column(String(24))
|
|
|
sending_time: Mapped[datetime] = mapped_column(
|
|
|
DateTime(timezone=True), default=datetime.now
|
|
|
)
|
|
|
- send_time: Mapped[datetime] = mapped_column(DateTime(timezone=True))
|
|
|
+ send_time: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=True)
|