Fix sqlite fk configuration and enable all tests for sqlite. Enable detail SQL log in tests (#1151)

* Fix sqlite fk configuration and enable all tests for sqlite.

* Add default severity to golangci-lint config.
This commit is contained in:
Googol Lee
2025-01-02 23:02:19 +01:00
committed by GitHub
parent 33ef0981d7
commit e045e0f7ae
4 changed files with 6 additions and 13 deletions

View File

@@ -65,6 +65,7 @@ func GetSqliteAddress(path string) (*url.URL, error) {
// queryValues.Add("_busy_timeout", "60000") // 1 minute
queryValues.Add("_journal_mode", "WAL") // Write-Ahead Logging (WAL) mode
queryValues.Add("_locking_mode", "NORMAL") // allows concurrent reads and writes
queryValues.Add("_foreign_keys", "ON") // Enforc foreign key constraints.
address.RawQuery = queryValues.Encode()
// log.Panicf("%s", address.String())
@@ -104,11 +105,6 @@ func ConfigureDatabase(config *gorm.Config) (*gorm.DB, error) {
return nil, err
}
// Manually enable foreign keys for sqlite, as this isn't done by default
if drivers.SQLITE.MatchDatabase(db) {
db.Exec("PRAGMA foreign_keys = ON")
}
return db, nil
}