Skip to content

Commit

Permalink
tesing db connection
Browse files Browse the repository at this point in the history
  • Loading branch information
p-shubh committed May 15, 2024
1 parent 0e97f37 commit 7a65b58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dbFlow/db.circulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ func ConnectHackDatabase() *gorm.DB {
dsn := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
dbHost, dbPort, dbUsername, dbPassword, dbName)

fmt.Println("dsn : ", dsn)

// Attempt to connect to the database
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
if err != nil {
log.Fatalf("failed to connect database: %v", err)
log.Printf("failed to connect database: %v", err)
}

// Optionally, you can enable automatic migrations
Expand Down

0 comments on commit 7a65b58

Please sign in to comment.