This commit is contained in:
6
db.go
6
db.go
@@ -31,6 +31,12 @@ func InitDB(dbPath string) error {
|
||||
return fmt.Errorf("failed to open database: %v", err)
|
||||
}
|
||||
|
||||
// Enable foreign key support in SQLite
|
||||
_, err = DB.Exec("PRAGMA foreign_keys = ON")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to enable foreign keys: %v", err)
|
||||
}
|
||||
|
||||
if err = DB.Ping(); err != nil {
|
||||
return fmt.Errorf("failed to ping database: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user