diff options
author | Thomas Voss <mail@thomasvoss.com> | 2025-06-14 00:41:27 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2025-06-14 00:41:27 +0200 |
commit | 4f14515613bd491dd0627398aa8fc3e3aef07945 (patch) | |
tree | 61d7ad4890707b280c15118c47281a02dc5000f7 /src/dbx/db.go | |
parent | 604cac8c0ab26a43d28341ff6f6e58e969eec925 (diff) |
Implement the ‘atexit’ package
Diffstat (limited to 'src/dbx/db.go')
-rw-r--r-- | src/dbx/db.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/dbx/db.go b/src/dbx/db.go index 5bd65a5..e97b9ea 100644 --- a/src/dbx/db.go +++ b/src/dbx/db.go @@ -11,6 +11,7 @@ import ( "github.com/mattn/go-sqlite3" + "git.thomasvoss.com/euro-cash.eu/src/atexit" . "git.thomasvoss.com/euro-cash.eu/src/try" ) @@ -22,6 +23,7 @@ var ( func Init(sqlDir fs.FS) { db = Try2(sql.Open("sqlite3", DBName)) Try(db.Ping()) + atexit.Register(Close) Try(applyMigrations(sqlDir)) /* TODO: Remove debug code */ @@ -120,7 +122,7 @@ func applyMigrations(dir fs.FS) error { if err := tx.Commit(); err != nil { return err } - log.Printf("Applied database migration ‘%s’", f) + log.Printf("Applied database migration ‘%s’\n", f) } if last != "" { |