db performance
This commit is contained in:
@@ -26,3 +26,5 @@
|
||||
|
||||
# ...even if they are in subdirectories
|
||||
!*/
|
||||
|
||||
/tmp/**
|
||||
@@ -56,6 +56,9 @@ func InitDatabase(path string) (*gorm.DB, error) {
|
||||
if err := db.Exec("PRAGMA foreign_keys = ON").Error; err != nil {
|
||||
return nil, fmt.Errorf("enable foreign keys: %w", err)
|
||||
}
|
||||
if err := db.Exec("PRAGMA synchronous = NORMAL").Error; err != nil {
|
||||
return nil, fmt.Errorf("set synchronous normal: %w", err)
|
||||
}
|
||||
|
||||
if err := db.AutoMigrate(&Upload{}, &Report{}); err != nil {
|
||||
migrationErr := fmt.Errorf("migrate database: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user