Skip to content

Commit

Permalink
fk
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Dec 26, 2023
1 parent 2462ac7 commit dff7067
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 0 additions & 1 deletion mapobjectdb/sqlite/migrations/01_init.up.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
PRAGMA foreign_keys = ON;
PRAGMA journal_mode = MEMORY;

create table if not exists objects(
Expand Down
6 changes: 5 additions & 1 deletion mapobjectdb/sqlite/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import (

func New(filename string) (*Sqlite3Accessor, error) {
db, err := sql.Open("sqlite", filename+"?_timeout=500")
db.SetMaxOpenConns(1)
if err != nil {
return nil, err
}

db.SetMaxOpenConns(1)
_, err = db.Exec("PRAGMA foreign_keys = ON")
if err != nil {
return nil, err
}
Expand Down

0 comments on commit dff7067

Please sign in to comment.