Skip to content

Commit

Permalink
"Moved two database initialization statements inside Init function"
Browse files Browse the repository at this point in the history
  • Loading branch information
p-shubh committed Sep 4, 2024
1 parent f8349d2 commit e449737
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions config/dbconfig/dbconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ func GetDb() *gorm.DB {

func Init() error {
db := GetDb()

// db.Exec(`ALTER TABLE leader_boards DROP COLUMN IF EXISTS users;`)
db.Exec(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`)

if err := db.AutoMigrate(
&migrate.User{},
&migrate.Role{},
Expand Down Expand Up @@ -79,9 +83,6 @@ func Init() error {
log.Fatal(err)
}

// db.Exec(`ALTER TABLE leader_boards DROP COLUMN IF EXISTS users;`)
db.Exec(`CREATE EXTENSION IF NOT EXISTS "uuid-ossp";`)

logwrapper.Log.Info("Congrats ! Automigration completed")

return nil
Expand Down

0 comments on commit e449737

Please sign in to comment.