Skip to content
This repository has been archived by the owner on Oct 24, 2022. It is now read-only.

Commit

Permalink
Merge pull request #221 from MITLibraries/220_fkey_violation
Browse files Browse the repository at this point in the history
Removes join table row to fix foreign key violation on interest deletion
  • Loading branch information
Richard Rodgers committed Jun 15, 2015
2 parents 7f8a9af + deffd64 commit 6f9d645
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions app/models/Subscriber.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,7 @@ case class Subscriber(id: Int, // DB key
}

def removeInterest(scheme: Scheme, intValue: String) = {
DB.withConnection { implicit c =>
SQL("delete from interest where subscriber_id = {subscriber_id} and scheme_tag = {scheme_tag} and int_value = {int_value}")
.on('subscriber_id -> id, 'scheme_tag -> scheme.tag, 'int_value -> intValue).executeUpdate()
}
interestWithValue(scheme.tag, intValue).map(i => Interest.delete(i.id))
}

def holdCount = {
Expand Down

0 comments on commit 6f9d645

Please sign in to comment.