Fixed database setup; finished item creation form
This commit is contained in:
1 parent
ec78e5e1ae
commit
ca6e14bcb5
6 files changed
+85
-5
No files matched your search
+5
-3
@@ -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