WIP checkpoint: Friends/follow/block models + Alembic migration

This commit is contained in:
2026-08-18 15:51:37 +00:00
parent ca06b459ec
commit 10dcd6eff2
4 changed files with 23 additions and 13 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ class Block(Base):
UniqueConstraint(
"blocker_id",
"blocked_id",
name="uq_blocks_blocker_blocked",
name="uq_blocks_pair",
),
CheckConstraint(
"blocker_id <> blocked_id",
@@ -39,7 +39,7 @@ class Block(Base):
blocker = relationship(
"User",
foreign_keys=[blocker_id],
back_populates="blocks_given",
back_populates="blocks_issued",
)
blocked = relationship(
"User",
+2 -2
View File
@@ -13,7 +13,7 @@ class Follow(Base):
UniqueConstraint(
"follower_id",
"followed_id",
name="uq_follows_follower_followed",
name="uq_follows_pair",
),
CheckConstraint(
"follower_id <> followed_id",
@@ -39,7 +39,7 @@ class Follow(Base):
follower = relationship(
"User",
foreign_keys=[follower_id],
back_populates="follows_given",
back_populates="following",
)
followed = relationship(
"User",
+3 -3
View File
@@ -28,7 +28,7 @@ class Friendship(Base):
UniqueConstraint(
"requester_id",
"addressee_id",
name="uq_friendships_requester_addressee",
name="uq_friendships_pair",
),
CheckConstraint(
"requester_id <> addressee_id",
@@ -65,10 +65,10 @@ class Friendship(Base):
requester = relationship(
"User",
foreign_keys=[requester_id],
back_populates="friendships_sent",
back_populates="sent_friend_requests",
)
addressee = relationship(
"User",
foreign_keys=[addressee_id],
back_populates="friendships_received",
back_populates="received_friend_requests",
)