mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 20:49:02 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user