17 lines
731 B
Go
17 lines
731 B
Go
package store
|
|
|
|
import (
|
|
"context"
|
|
"pageswiki/internal/db"
|
|
"pageswiki/internal/mestionora"
|
|
)
|
|
|
|
func (s *Store) EnsureSearchIndexSchema() error {
|
|
if s.sqlBackend == storePostgreSQL {
|
|
return db.ApplyPostgreSQLMigrations(context.Background(), s.DB, "store-search-metadata", []db.PostgreSQLMigration{{Version: 1, Name: "bounded latest revision metadata search", Statements: []string{
|
|
`CREATE INDEX idx_revisions_search_latest ON revisions(object_uuid,created_at_ms DESC,uuid DESC)`,
|
|
}, Assertions: []string{`SELECT domain_uuid,path,object_uuid FROM paths WHERE 1=0`, `SELECT uuid,content_type,filename,document_hash,created_at_ms FROM revisions WHERE 1=0`}}})
|
|
}
|
|
return mestionora.NewSQLite(s.DB).EnsureSearchIndexSchema()
|
|
}
|