add "granted_by" column to awards instead of "granted"
parent
97dc727e22
commit
a775a03035
|
@ -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")
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue