Pull Proclamations & Categories from API and store them in the database
This commit is contained in:
@@ -41,7 +41,7 @@ func Connect(dbpath string) (*gorm.DB, error) {
|
||||
// Migrate the database schema
|
||||
func Migrate(db *gorm.DB) error {
|
||||
// Pass all models to be migrated to this function call.
|
||||
if err := db.AutoMigrate(&AppConfig{}, &Log{}, &Proclamation{}); err != nil {
|
||||
if err := db.AutoMigrate(&AppConfig{}, &Log{}, &Proclamation{}, &ProclamationCategory{}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -27,7 +27,6 @@ type Log struct {
|
||||
}
|
||||
|
||||
type Proclamation struct {
|
||||
gorm.Model
|
||||
ID string `gorm:"primaryKey"`
|
||||
Name string
|
||||
Content string
|
||||
@@ -37,3 +36,9 @@ type Proclamation struct {
|
||||
Available bool
|
||||
Price float64
|
||||
}
|
||||
|
||||
type ProclamationCategory struct {
|
||||
ID int `gorm:"primaryKey"`
|
||||
Name string
|
||||
ParentId int
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user