Skip to content

Commit

Permalink
Remove DB migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
bbedward committed Mar 4, 2024
1 parent 4c79035 commit 1b6652d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions apps/server/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ func runServer() {
panic(err)
}

fmt.Println("🦋 Running database migrations...")
err = database.Migrate(db)
if err != nil {
fmt.Printf("Error running database migrations %v", err)
os.Exit(1)
}
// fmt.Println("🦋 Running database migrations...")
// err = database.Migrate(db)
// if err != nil {
// fmt.Printf("Error running database migrations %v", err)
// os.Exit(1)
// }

port := os.Getenv("PORT")
if port == "" {
Expand All @@ -74,6 +74,7 @@ func runServer() {
userRepo := repository.NewUserService((db))
workRepo := repository.NewWorkService(db, userRepo)
paymentRepo := repository.NewPaymentService(db)
fmt.Println("Repository created")

precacheMap := &sync.Map{}

Expand Down Expand Up @@ -245,11 +246,13 @@ func runServer() {

// Update stats and setup cron
repository.UpdateStats(paymentRepo, workRepo)
fmt.Println("🕒 Setting up cron...")
scheduler := gocron.NewScheduler(time.UTC)
scheduler.Every(10).Minutes().Do(func() {
repository.UpdateStats(paymentRepo, workRepo)
})

fmt.Println("🚀 Starting server...")
log.Fatal(http.ListenAndServe(":"+port, router))
}

Expand Down

0 comments on commit 1b6652d

Please sign in to comment.