This commit is contained in:
Yvan
2026-09-23 17:42:55 +08:00
parent 0a8ecbe09b
commit 435b601273
42 changed files with 2845 additions and 154 deletions
+21
View File
@@ -0,0 +1,21 @@
package main
import (
"fmt"
"path/filepath"
"github.com/glebarez/sqlite"
"gorm.io/gorm"
)
func openFixtureDB() (*gorm.DB, error) {
path, err := filepath.Abs(filepath.Join(outputDir, "acceptance.db"))
if err != nil {
return nil, err
}
root, err := filepath.Abs(outputDir)
if err != nil || filepath.Dir(path) != root {
return nil, fmt.Errorf("database path is not inside the acceptance directory")
}
return gorm.Open(sqlite.Open(path), &gorm.Config{})
}