make provision
make up
Or, if you want it to run in the background, use the command below.
make provision
make upd
dip provision
dip up
make yarninstall
Migration files are located at db/migrate directory.
make migrate_up
make migrate_down
example:
make migrate_force VER=20220312013850
example:
make migrate_g NAME=create_products_table
Go to the following URL with your browser.
make down
make downall
Always include gorm.Model
type Product struct {
gorm.Model
Name string `json:"name" `
Price int `json:"price" `
Description string `json:"description" `
Image string `json:"image" `
}
// gorm.Modelの定義
type Model struct {
ID uint `gorm:"primaryKey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
}