fix bug with json default values

This commit is contained in:
Sonja Happ 2019-05-21 15:46:40 +02:00
parent 5409c61939
commit d7d07e1db4

View file

@ -23,7 +23,7 @@ type Simulation struct {
ID uint `gorm:"primary_key;auto_increment"` ID uint `gorm:"primary_key;auto_increment"`
Name string `gorm:"not null"` Name string `gorm:"not null"`
Running bool `gorm:"default:false"` Running bool `gorm:"default:false"`
StartParameters postgres.Jsonb `gorm:"default:{}"` StartParameters postgres.Jsonb
Users []User `gorm:"not null;many2many:user_simulations"` Users []User `gorm:"not null;many2many:user_simulations"`
Models []Model `gorm:"foreignkey:SimulationID"` Models []Model `gorm:"foreignkey:SimulationID"`
@ -36,7 +36,7 @@ type Model struct {
Name string `gorm:"not null"` Name string `gorm:"not null"`
OutputLength int `gorm:"default:1"` OutputLength int `gorm:"default:1"`
InputLength int `gorm:"default:1"` InputLength int `gorm:"default:1"`
StartParameters postgres.Jsonb `gorm:"default:{}"` StartParameters postgres.Jsonb
SimulationID uint SimulationID uint
Simulator Simulator Simulator Simulator
@ -71,8 +71,8 @@ type Simulator struct {
Uptime int `gorm:"default:0"` Uptime int `gorm:"default:0"`
State string `gorm:"default:''"` State string `gorm:"default:''"`
StateUpdateAt time.Time StateUpdateAt time.Time
Properties postgres.Jsonb `gorm:"default:{}"` Properties postgres.Jsonb
RawProperties postgres.Jsonb `gorm:"default:{}"` RawProperties postgres.Jsonb
} }
type Visualization struct { type Visualization struct {
@ -99,7 +99,7 @@ type Widget struct {
Y int `gorm:"not null"` Y int `gorm:"not null"`
Z int `gorm:"not null"` Z int `gorm:"not null"`
IsLocked bool `gorm:"default:false"` IsLocked bool `gorm:"default:false"`
CustomProperties postgres.Jsonb `gorm:"default:{}"` CustomProperties postgres.Jsonb
VisualizationID uint `gorm:"not null"` VisualizationID uint `gorm:"not null"`
//new in villasweb 2.0 //new in villasweb 2.0
Files []File `gorm:"foreignkey:WidgetID"` Files []File `gorm:"foreignkey:WidgetID"`