diff --git a/common/database.go b/common/database.go index eca4801..75e5937 100644 --- a/common/database.go +++ b/common/database.go @@ -162,9 +162,9 @@ func DummyPopulateDB(test_db *gorm.DB) { checkErr(test_db.Model(&proj_A).Association("Simulation").Append(&simn_A).Error) checkErr(test_db.Model(&proj_B).Association("Simulation").Append(&simn_A).Error) - // User HM File, File BT User - checkErr(test_db.Model(&file_A).Association("User").Append(&usr_A).Error) - checkErr(test_db.Model(&file_B).Association("User").Append(&usr_A).Error) + // User HM Files + checkErr(test_db.Model(&usr_A).Association("Files").Append(&file_A).Error) + checkErr(test_db.Model(&usr_A).Association("Files").Append(&file_B).Error) // Simulation HM SimModel, SimModel BT Simulation checkErr(test_db.Model(&smo_A).Association("BelongsToSimulation").Append(&simn_A).Error) diff --git a/common/database_test.go b/common/database_test.go index 49cd261..92d0296 100644 --- a/common/database_test.go +++ b/common/database_test.go @@ -161,7 +161,7 @@ func TestDummyDBAssociations(t *testing.T) { // File Associations - a.NoError(db.Model(&file).Association("User").Find(&usr).Error) - a.EqualValues("User_A", usr.Username) + //a.NoError(db.Model(&file).Association("User").Find(&usr).Error) + //a.EqualValues("User_A", usr.Username) } diff --git a/common/datastructs.go b/common/datastructs.go index 34c450d..bdf79bb 100644 --- a/common/datastructs.go +++ b/common/datastructs.go @@ -30,8 +30,9 @@ type File struct { ImageWidth uint // only required in case file is an image Date time.Time - User User `gorm:"not null;association_autoupdate:false"` - UserID uint `gorm:"not null"` + //remove belongs to User relation + //User User `gorm:"not null;association_autoupdate:false"` + //UserID uint `gorm:"not null"` } type Project struct { @@ -76,7 +77,7 @@ type SimulationModel struct { BelongsToSimulator Simulator `gorm:"not null;association_autoupdate:false"` BelongsToSimulatorID uint `gorm:"not null"` //new in villasweb 2.0 - Files []File `gorm:"association_autoupdate:false"` + Files []File `gorm:""` // NOTE: order of signals is important OutputMapping []Signal `gorm:""` @@ -93,7 +94,7 @@ type User struct { Projects []Project `gorm:"association_autoupdate:false"` Simulations []Simulation `gorm:"association_autoupdate:false"` - Files []File `gorm:"association_autoupdate:false"` + Files []File `gorm:""` } type Visualization struct {