detached 969d0e7

feat(db): run embedded migrations during browser init

commit
969d0e752fc0fe071157b36bdbc043b4e7bb19d8
author
bamen · · 2025-09-17 05:17 UTC
parent
1f8c828
signature
unsigned
1 file · +8 -0
M internal/app/browser/browser.go +8 -0
@@ -3,6 +3,7 @@ package browser
33 import (
44 "database/sql"
55 "embed"
6+ "fmt"
67 "log"
78 "os"
89 "os/signal"
@@ -16,6 +17,7 @@ import (
1617 "github.com/bnema/dumber/internal/config"
1718 "github.com/bnema/dumber/internal/db"
1819 "github.com/bnema/dumber/internal/filtering"
20+ "github.com/bnema/dumber/internal/migrations"
1921 "github.com/bnema/dumber/internal/logging"
2022 "github.com/bnema/dumber/pkg/webkit"
2123 "github.com/bnema/dumber/services"
@@ -116,6 +118,12 @@ func (app *BrowserApp) Initialize() error {
116118 return err
117119 }
118120 app.database = database
121+
122+ // Run database migrations
123+ if err := migrations.RunEmbeddedMigrations(database); err != nil {
124+ return fmt.Errorf("failed to run database migrations: %w", err)
125+ }
126+
119127 app.queries = db.New(database)
120128 log.Printf("Database opened at %s", app.config.Database.Path)
121129
@@ -3,6 +3,7 @@ package browser
3 import (3 import (
4 "database/sql"4 "database/sql"
5 "embed"5 "embed"
6+ "fmt"
6 "log"7 "log"
7 "os"8 "os"
8 "os/signal"9 "os/signal"
@@ -16,6 +17,7 @@ import (
16 "github.com/bnema/dumber/internal/config"17 "github.com/bnema/dumber/internal/config"
17 "github.com/bnema/dumber/internal/db"18 "github.com/bnema/dumber/internal/db"
18 "github.com/bnema/dumber/internal/filtering"19 "github.com/bnema/dumber/internal/filtering"
20+ "github.com/bnema/dumber/internal/migrations"
19 "github.com/bnema/dumber/internal/logging"21 "github.com/bnema/dumber/internal/logging"
20 "github.com/bnema/dumber/pkg/webkit"22 "github.com/bnema/dumber/pkg/webkit"
21 "github.com/bnema/dumber/services"23 "github.com/bnema/dumber/services"
@@ -116,6 +118,12 @@ func (app *BrowserApp) Initialize() error {
116 return err118 return err
117 }119 }
118 app.database = database120 app.database = database
121+
122+ // Run database migrations
123+ if err := migrations.RunEmbeddedMigrations(database); err != nil {
124+ return fmt.Errorf("failed to run database migrations: %w", err)
125+ }
126+
119 app.queries = db.New(database)127 app.queries = db.New(database)
120 log.Printf("Database opened at %s", app.config.Database.Path)128 log.Printf("Database opened at %s", app.config.Database.Path)
121 129

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close