add "granted_by" column to awards instead of "granted"

remotes/1693045480750635534/spooky-22
Aevann1 2022-09-20 23:30:04 +02:00
parent 97dc727e22
commit a775a03035
2 changed files with 6 additions and 1 deletions

View File

@ -15,7 +15,7 @@ class AwardRelationship(Base):
comment_id = Column(Integer, ForeignKey("comments.id"))
kind = Column(String)
awarded_utc = Column(Integer)
granted = Column(Boolean)
granted_by = Column(Integer, ForeignKey("users.id"))
created_utc = Column(Integer)
user = relationship("User", primaryjoin="AwardRelationship.user_id==User.id", back_populates="awards")

View File

@ -0,0 +1,5 @@
alter table award_relationships add column granted_by int;
ALTER TABLE ONLY public.award_relationships
ADD CONSTRAINT award_granted_by_fkey FOREIGN KEY (granted_by) REFERENCES public.users(id);
update award_relationships set granted_by=1 where granted=true;
alter table award_relationships drop column granted;