fixes in prod

This commit is contained in:
Alex
2025-05-14 12:29:47 +02:00
parent 06f8078b17
commit 11740cb503
5 changed files with 14 additions and 7 deletions

View File

@@ -50,8 +50,8 @@ func Open(dbPath string, adminMail string, debug bool) (*gorm.DB, error) {
sqlDB.SetMaxIdleConns(1)
sqlDB.SetConnMaxLifetime(time.Hour)
db.Exec("PRAGMA foreign_keys = OFF;")
if err := db.AutoMigrate(
&models.User{},
&models.Subscription{},
&models.Membership{},
&models.Consent{},
@@ -62,11 +62,12 @@ func Open(dbPath string, adminMail string, debug bool) (*gorm.DB, error) {
&models.Car{},
&models.Location{},
&models.Damage{},
&models.Insurance{},
// &models.Insurance{},
// &models.User{},
); err != nil {
return nil, fmt.Errorf("failed to migrate database: %w", err)
}
db.Exec("PRAGMA foreign_keys = ON;")
logger.Info.Print("Opened DB")
DB = db
var categoriesCount int64