Skip to content

Commit b5e7200

Browse files
committed
**feat(postgresql): improve database configuration and parameter handling**
- **Auto-Migrate**: - Add conditional import for `models` package based on `.IncludeAutoMigrate` to allow dynamic inclusion in PostgreSQL configurations. - **Connection Parameters**: - Rename `DbSSLMode` to `SSLMode` for consistency with standard PostgreSQL connection options. This update enhances flexibility in auto-migration handling and aligns parameter naming with PostgreSQL conventions.
1 parent ef62661 commit b5e7200

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

postgresql.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ import (
241241
slogGorm "github.com/orandin/slog-gorm"
242242
"gorm.io/driver/postgres"
243243
"gorm.io/gorm"
244+
{{if .IncludeAutoMigrate}}
244245
"{{.FullPackageName}}/models"
246+
{{end}}
245247
)
246248
247249
var (
@@ -265,7 +267,7 @@ func DbInit(optionalDSN ...string) {
265267
Name: DbName,
266268
User: DbUser,
267269
Password: DbPassword,
268-
DbSSLMode: DbSSLMode,
270+
SSLMode: DbSSLMode,
269271
})
270272
}
271273
slog.Info("Connecting to database", slog.String("host", DbHost), slog.Int("port", DbPort), slog.String("db", DbName), slog.String("user", DbUser))

0 commit comments

Comments
 (0)