diff --git a/models/models.go b/models/models.go index 3736efa..0caeb51 100644 --- a/models/models.go +++ b/models/models.go @@ -11,11 +11,12 @@ type User struct { // CREATE TABLE plans(id INTEGER PRIMARY KEY AUTOINCREMENT, name STRING, owner STRING, FOREIGN KEY(owner) REFERENCES users(username)) // CREATE TABLE plan_user_relations(username STRING, plan INTEGER, PRIMARY KEY(username, plan), FOREIGN KEY username REFERENCES user(username), FOREIGN KEY plan REFERENCES plans(id)) type Plan struct { - ID uint `gorm:"primaryKey;autoIncrement:true" json:"id"` - Name string `json:"name"` - Owner string `json:"owner"` - Members []User `gorm:"many2many:user_plans;" json:"-"` - Polls []Poll `gorm:"foreignKey:PlanID;references:ID" json:"-"` + ID uint `gorm:"primaryKey;autoIncrement:true" json:"id"` + Name string `json:"name"` + Owner string `json:"owner"` + Description string `json:"description"` + Members []User `gorm:"many2many:user_plans;" json:"-"` + Polls []Poll `gorm:"foreignKey:PlanID;references:ID" json:"-"` } // CREATE TABLE polls(id INTEGER PRIMARY KEY AUTOINCREMENT, plan INTEGER, name STRING, options JSON, FOREIGN KEY plan REFERENCES plans(id))