Feat: settings repo

This commit is contained in:
Grail Finder
2025-07-04 13:32:59 +03:00
parent 058d501774
commit 6be365473c
9 changed files with 72 additions and 19 deletions

View File

@ -17,6 +17,7 @@ type AllRepos interface {
PlayersRepo
SessionsRepo
WordCardsRepo
SettingsRepo
InitTx(ctx context.Context) (context.Context, *sqlx.Tx, error)
}
@ -32,6 +33,11 @@ func NewRepoProvider(pathToDB string) *RepoProvider {
slog.Error("Unable to connect to database", "error", err)
os.Exit(1)
}
_, err = db.Exec("PRAGMA foreign_keys = ON;")
if err != nil {
slog.Error("Unable to enable foreign keys", "error", err)
os.Exit(1)
}
slog.Info("Successfully connected to database")
rp := &RepoProvider{
DB: db,