Enable foreign keys in SQLite

This commit is contained in:
Tulir Asokan 2019-07-18 00:06:50 +03:00
parent 92958343dd
commit 921c1209ea

View file

@ -43,6 +43,10 @@ func New(dbType string, uri string) (*Database, error) {
return nil, err return nil, err
} }
if dbType == "sqlite3" {
_, _ = conn.Exec("PRAGMA foreign_keys = ON")
}
db := &Database{ db := &Database{
DB: conn, DB: conn,
log: log.Sub("Database"), log: log.Sub("Database"),