Fixed database setup; finished item creation form
This commit is contained in:
@ -6,15 +6,17 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
DB gorm.DB
|
||||
DB *gorm.DB
|
||||
)
|
||||
|
||||
func InitDatabase() {
|
||||
DB, err := gorm.Open(sqlite.Open("data/raven.db"), &gorm.Config{})
|
||||
database, err := gorm.Open(sqlite.Open("data/raven.db"), &gorm.Config{})
|
||||
if err != nil {
|
||||
panic("failed to connect database")
|
||||
}
|
||||
|
||||
// Migrate the schema
|
||||
DB.AutoMigrate(&Item{})
|
||||
database.AutoMigrate(&Item{})
|
||||
|
||||
DB = database
|
||||
}
|
||||
|
Reference in New Issue
Block a user