sqldb/sqlite: enable incremental auto_vacuum on DB creation
This commit is contained in:
1 file changed
+11
-4
+11
-4
@@ -40,6 +40,12 @@ var (
|
|||||||
_ DB = (*SqliteStore)(nil)
|
_ DB = (*SqliteStore)(nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// pragmaOption holds a key-value pair for a SQLite pragma setting.
|
||||||
|
type pragmaOption struct {
|
||||||
|
name string
|
||||||
|
value string
|
||||||
|
}
|
||||||
|
|
||||||
// SqliteStore is a database store implementation that uses a sqlite backend.
|
// SqliteStore is a database store implementation that uses a sqlite backend.
|
||||||
type SqliteStore struct {
|
type SqliteStore struct {
|
||||||
cfg *SqliteConfig
|
cfg *SqliteConfig
|
||||||
@@ -53,10 +59,7 @@ func NewSqliteStore(cfg *SqliteConfig, dbPath string) (*SqliteStore, error) {
|
|||||||
// The set of pragma options are accepted using query options. For now
|
// The set of pragma options are accepted using query options. For now
|
||||||
// we only want to ensure that foreign key constraints are properly
|
// we only want to ensure that foreign key constraints are properly
|
||||||
// enforced.
|
// enforced.
|
||||||
pragmaOptions := []struct {
|
pragmaOptions := []pragmaOption{
|
||||||
name string
|
|
||||||
value string
|
|
||||||
}{
|
|
||||||
{
|
{
|
||||||
name: "foreign_keys",
|
name: "foreign_keys",
|
||||||
value: "on",
|
value: "on",
|
||||||
@@ -84,6 +87,10 @@ func NewSqliteStore(cfg *SqliteConfig, dbPath string) (*SqliteStore, error) {
|
|||||||
name: "fullfsync",
|
name: "fullfsync",
|
||||||
value: "true",
|
value: "true",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "auto_vacuum",
|
||||||
|
value: "incremental",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
sqliteOptions := make(url.Values)
|
sqliteOptions := make(url.Values)
|
||||||
for _, option := range pragmaOptions {
|
for _, option := range pragmaOptions {
|
||||||
|
|||||||
Reference in new issue
Block a user