Only create index if not exists (#347)

This commit is contained in:
Alexander Leitner 2018-09-12 12:23:21 -04:00 committed by GitHub
parent 0b947355da
commit 4397b90349
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,7 +74,7 @@ func Open(ctx context.Context, DataPath, DBPath string) (db *DB, err error) {
return nil, err return nil, err
} }
_, err = tx.Exec("CREATE INDEX idx_ttl_expires ON ttl (expires);") _, err = tx.Exec("CREATE INDEX IF NOT EXISTS idx_ttl_expires ON ttl (expires);")
if err != nil { if err != nil {
return nil, err return nil, err
} }