started datamodelling papas excel tables
This commit is contained in:
@@ -27,18 +27,26 @@ func initLogging() {
|
||||
gin.DefaultWriter = f // capture Gin logs too
|
||||
}
|
||||
|
||||
func dbMigration() {
|
||||
database.DB.AutoMigrate(
|
||||
&models.AssetType{},
|
||||
&models.Asset{},
|
||||
&models.LogType{},
|
||||
&models.Log{},
|
||||
)
|
||||
|
||||
db.Create(&models.AssetType{Name: "machine"})
|
||||
db.Create(&models.AssetType{Name: "field"})
|
||||
db.Create(&models.AssetType{Name: "animal"})
|
||||
db.Create(&models.AssetType{Name: "substance"})
|
||||
}
|
||||
|
||||
func main() {
|
||||
initLogging()
|
||||
|
||||
log.Println("Starting API server...")
|
||||
|
||||
database.Connect()
|
||||
database.DB.AutoMigrate(
|
||||
&models.AssetType{},
|
||||
&models.Asset{},
|
||||
&models.LogType{},
|
||||
&models.Log{},
|
||||
)
|
||||
|
||||
r := gin.Default()
|
||||
routes.SetupRoutes(r)
|
||||
|
||||
Reference in New Issue
Block a user