Skip to content

Commit

Permalink
added schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Pacerino committed Dec 29, 2024
1 parent 99c83ed commit c0b4fac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion database.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,15 @@ import (
log "github.com/sirupsen/logrus"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/schema"
)

func connectDB(dsn string) (*gorm.DB, error) {
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})
db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{
NamingStrategy: schema.NamingStrategy{
TablePrefix: "pr0music.", // schema name
SingularTable: false,
}})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c0b4fac

Please sign in to comment.