Widyarhn
1 year ago
5 changed files with 18 additions and 15 deletions
Binary file not shown.
@ -0,0 +1,9 @@
|
||||
package initializers |
||||
|
||||
import "go-crud/models" |
||||
|
||||
func SyncDatabase() { |
||||
DB.AutoMigrate(&models.Post{}) |
||||
DB.AutoMigrate(&models.Event{}) |
||||
DB.AutoMigrate(&models.User{}) |
||||
} |
@ -1,15 +0,0 @@
|
||||
package main |
||||
|
||||
import "go-crud/initializers" |
||||
import "go-crud/models" |
||||
|
||||
func init() { |
||||
initializers.LoadEnvVariables() |
||||
initializers.ConnectToDB() |
||||
} |
||||
|
||||
func main() { |
||||
initializers.DB.AutoMigrate(&models.Post{}) |
||||
initializers.DB.AutoMigrate(&models.Event{}) |
||||
initializers.DB.AutoMigrate(&models.User{}) |
||||
} |
Loading…
Reference in new issue