add experience_links table

This commit is contained in:
Giovanni committed 2026-10-07 22:01:41 +02:00
1 parent 11bfc9e387
commit 13982ac495
3 files changed
+46

No files matched your search

+6
View File
@@ -44,4 +44,10 @@ class Experience(Base):
"ExperienceTask",
back_populates="experience",
cascade="all, delete-orphan"
)
links = relationship(
"ExperienceLink",
back_populates="experience",
cascade="all, delete-orphan"
)
@@ -0,0 +1,39 @@
from sqlalchemy import (
Column,
Integer,
String,
ForeignKey
)
from sqlalchemy.orm import relationship
from app.database import Base
class ExperienceLinks(Base):
__tablename__ = "experience_links"
id = Column(
Integer,
primary_key=True,
index=True
)
link = Column(
String(255),
nullable=False
)
experience_id = Column(
Integer,
ForeignKey(
"experiences.id",
ondelete="CASCADE"
),
nullable=False
)
experience = relationship(
"Experience",
back_populates="links"
)
+1
View File
@@ -14,6 +14,7 @@ class ExperienceResponse(BaseModel):
duration: str
role: str
tasks: list[ExperienceTaskResponse]
links: list[ExperienceLinkResponse]
class Config:
from_attributes = True