Skip to content

Commit

Permalink
Fix sqlite bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
efixler committed May 6, 2024
1 parent bb1ba9e commit 6a4b557
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 0 additions & 5 deletions internal/storage/sqlite/migrations/20240505192733_init.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
-- +goose Up
-- +goose StatementBegin
PRAGMA foreign_keys = off;
PRAGMA page_size = 16384; -- default is 4096 but text records are big
PRAGMA temp_store = MEMORY;
PRAGMA auto_vacuum = INCREMENTAL;

CREATE TABLE IF NOT EXISTS id_map (
requested_id INTEGER PRIMARY KEY ON CONFLICT REPLACE
NOT NULL,
Expand Down
4 changes: 4 additions & 0 deletions internal/storage/sqlite/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ func (s *Store) Open(ctx context.Context) error {
// In Memory DBs must always be created
needsCreate := s.config.IsInMemory() || !exists(s.config.filename)
if needsCreate {
// Todo: Merge create and migrate into a single operation
if err := s.Create(); err != nil {
return err
}
if err := s.Migrate(); err != nil {
return err
}
}
s.Maintenance(24*time.Hour, maintain)
return nil
Expand Down

0 comments on commit 6a4b557

Please sign in to comment.