#189 fixing the delete-user script by cascading the delete to other tables
Merged 7 years ago by skrzepto. Opened 7 years ago by skrzepto.
skrzepto/fedora-hubs delete-user-fix  into  develop

file modified
+1 -1
@@ -107,7 +107,7 @@ 

                          primary_key=True)

      role = sa.Column(sa.Enum(*roles), primary_key=True)

  

-     user = relation("User", backref="associations")

+     user = relation("User", backref=backref('associations', cascade="all, delete-orphan"))

      hub = relation("Hub", backref="associations")

  

      @classmethod

The delete-user script throws an error

AssertionError: Dependency rule tried to blank-out primary key column 'association.user_id' on instance '<Association at 0x7f308f9efd90>'

i adjusted the schema so when you delete the user it cascades to other tables as well

:thumbsup: for me

Maybe we could check if there are more

Pull-Request has been merged by skrzepto

7 years ago
Metadata