diff options
| -rw-r--r-- | customer/customer.go | 2 | ||||
| -rw-r--r-- | customer/service.go | 1 | ||||
| -rw-r--r-- | main.go | 2 | 
3 files changed, 3 insertions, 2 deletions
diff --git a/customer/customer.go b/customer/customer.go index 6e7d2e5..c1290bf 100644 --- a/customer/customer.go +++ b/customer/customer.go @@ -54,5 +54,5 @@ type Customer struct {  	Email             string  	Website           string  	BillingAddress    CustomerBillingAddress -	ShippingAddresses []CustomerShippingAddress +	ShippingAddresses []CustomerShippingAddress `gorm:"index;constraint:OnDelete:CASCADE;"`  } diff --git a/customer/service.go b/customer/service.go index 77b4dfa..8cd2bde 100644 --- a/customer/service.go +++ b/customer/service.go @@ -53,6 +53,7 @@ func getCustomers(customers *[]Customer, userId uint) error {  }  func (c *Customer) upsert() error { +	db.Model(&c).Association("ShippingAddresses").Replace(c.ShippingAddresses)  	res := db.Session(&gorm.Session{FullSaveAssociations: true}).Save(&c)  	// TODO: handle potential errors  	return res.Error @@ -38,7 +38,7 @@ import (  	"log"  ) -const OPENBILLS_VERSION = "v0.13.2" +const OPENBILLS_VERSION = "v0.14.0"  func init() {  	if !viper.GetBool("debug_mode") {  |