Skip to content

Commit

Permalink
Revert back to using file URI for sqlite dsn (#2731)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbreiding committed Apr 20, 2022
1 parent 762bf91 commit d98c7f0
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/persistence/sql/sqlPersistenceTest.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (s *TestCluster) CreateDatabase() {
func (s *TestCluster) DropDatabase() {
cfg2 := s.cfg

if cfg2.PluginName == "sqlite" {
if cfg2.PluginName == "sqlite" && cfg2.DatabaseName != ":memory:" && cfg2.ConnectAttributes["mode"] != "memory" {
if len(cfg2.DatabaseName) > 3 { // 3 should mean not ., .., empty, or /
err := os.Remove(cfg2.DatabaseName)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion common/persistence/sql/sqlplugin/sqlite/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func buildDSN(cfg *config.SQL) (string, error) {
return "", err
}
dsn := fmt.Sprintf(
"%s?%v",
"file:%s?%v",
cfg.DatabaseName,
vals.Encode(),
)
Expand Down
2 changes: 1 addition & 1 deletion common/persistence/sql/sqlplugin/tests/sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func newSQLiteMemoryConfig() *config.SQL {
"cache": "private",
},
PluginName: sqlite.PluginName,
DatabaseName: ":memory:",
DatabaseName: "default",
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/persistence/tests/sqlite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ func NewSQLiteMemoryConfig() *config.SQL {
ConnectAddr: environment.Localhost,
ConnectProtocol: "tcp",
PluginName: "sqlite",
DatabaseName: ":memory:",
DatabaseName: "default",
ConnectAttributes: map[string]string{"mode": "memory", "cache": "private"},
}
}
Expand Down
1 change: 0 additions & 1 deletion config/development_sqlite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ persistence:
connectAttributes:
mode: "memory"
cache: "private"
setup: true
maxConns: 1
maxIdleConns: 1
maxConnLifetime: "1h"
Expand Down

0 comments on commit d98c7f0

Please sign in to comment.