mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-26 06:52:23 +02:00
Add an index on end_time to ensure that initial queries are fast to fix #68
This commit is contained in:
parent
c31a75e768
commit
dc65fffd7b
@ -37,7 +37,7 @@ type HistoryEntry struct {
|
||||
HomeDirectory string `json:"home_directory" gorm:"uniqueIndex:compositeindex"`
|
||||
ExitCode int `json:"exit_code" gorm:"uniqueIndex:compositeindex"`
|
||||
StartTime time.Time `json:"start_time" gorm:"uniqueIndex:compositeindex"`
|
||||
EndTime time.Time `json:"end_time" gorm:"uniqueIndex:compositeindex"`
|
||||
EndTime time.Time `json:"end_time" gorm:"uniqueIndex:compositeindex,index:end_time_index"`
|
||||
DeviceId string `json:"device_id" gorm:"uniqueIndex:compositeindex"`
|
||||
CustomColumns CustomColumns `json:"custom_columns"`
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ func OpenLocalSqliteDb() (*gorm.DB, error) {
|
||||
}
|
||||
db.AutoMigrate(&data.HistoryEntry{})
|
||||
db.Exec("PRAGMA journal_mode = WAL")
|
||||
db.Exec("CREATE INDEX IF NOT EXISTS end_time_index ON history_entries(end_time)")
|
||||
return db, nil
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,12 @@ import (
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
"github.com/charmbracelet/bubbles/spinner"
|
||||
"github.com/ddworken/hishtory/client/table"
|
||||
"github.com/charmbracelet/bubbles/textinput"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/ddworken/hishtory/client/data"
|
||||
"github.com/ddworken/hishtory/client/hctx"
|
||||
"github.com/ddworken/hishtory/client/table"
|
||||
"github.com/ddworken/hishtory/shared"
|
||||
"github.com/muesli/termenv"
|
||||
"golang.org/x/term"
|
||||
|
Loading…
x
Reference in New Issue
Block a user