Added a description in DB

This commit is contained in:
Manuel Forcén Muñoz 2025-01-14 19:28:25 +01:00
parent 98f3c2aedc
commit 496b51646e

View file

@ -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 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)) // 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 { type Plan struct {
ID uint `gorm:"primaryKey;autoIncrement:true" json:"id"` ID uint `gorm:"primaryKey;autoIncrement:true" json:"id"`
Name string `json:"name"` Name string `json:"name"`
Owner string `json:"owner"` Owner string `json:"owner"`
Members []User `gorm:"many2many:user_plans;" json:"-"` Description string `json:"description"`
Polls []Poll `gorm:"foreignKey:PlanID;references:ID" json:"-"` 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)) // CREATE TABLE polls(id INTEGER PRIMARY KEY AUTOINCREMENT, plan INTEGER, name STRING, options JSON, FOREIGN KEY plan REFERENCES plans(id))