mirror of
				https://github.com/aclindsa/moneygo.git
				synced 2025-10-30 01:23:26 -04:00 
			
		
		
		
	Delete prices when deleting security
This commit is contained in:
		| @@ -199,6 +199,14 @@ func DeleteSecurity(s *Security) error { | ||||
| 		return errors.New("Cannot delete security which is user's default currency") | ||||
| 	} | ||||
|  | ||||
| 	// Remove all prices involving this security (either of this security, or | ||||
| 	// using it as a currency) | ||||
| 	_, err = transaction.Exec("DELETE * FROM prices WHERE SecurityId=? OR CurrencyId=?", s.SecurityId, s.SecurityId) | ||||
| 	if err != nil { | ||||
| 		transaction.Rollback() | ||||
| 		return err | ||||
| 	} | ||||
|  | ||||
| 	count, err := transaction.Delete(s) | ||||
| 	if err != nil { | ||||
| 		transaction.Rollback() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user