Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
41 lines
1.5 KiB
Go
41 lines
1.5 KiB
Go
package mestionora
|
|
|
|
import (
|
|
"database/sql"
|
|
"testing"
|
|
|
|
"pageswiki/internal/db"
|
|
)
|
|
|
|
func newSearchTestDB(t *testing.T) *sql.DB {
|
|
t.Helper()
|
|
database, err := db.Open(t.TempDir() + "/search.db")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Cleanup(func() { database.Close() })
|
|
initSearchFixture(t, database)
|
|
return database
|
|
}
|
|
|
|
// Only the application columns/indexes consumed by search, not application
|
|
// bootstrap, auth keys, job recovery or external calendar initialization.
|
|
func initSearchFixture(t *testing.T, database *sql.DB) {
|
|
t.Helper()
|
|
_, err := database.Exec(`
|
|
CREATE TABLE objects(uuid TEXT PRIMARY KEY, created_at INTEGER);
|
|
CREATE TABLE revisions(uuid TEXT PRIMARY KEY,object_uuid TEXT,filename TEXT,body TEXT,content_type TEXT,document_hash TEXT,created_at_ms INTEGER,created_at INTEGER);
|
|
CREATE TABLE paths(domain_uuid TEXT NOT NULL,path TEXT NOT NULL,object_uuid TEXT,PRIMARY KEY(domain_uuid,path));
|
|
CREATE INDEX idx_paths_object_domain_page ON paths(object_uuid,domain_uuid,path);
|
|
CREATE TABLE zones(uuid TEXT PRIMARY KEY,domain_uuid TEXT,kind TEXT,parent_uuid TEXT,name TEXT,title TEXT,description TEXT,path_prefix TEXT,state TEXT,created_at_ms INTEGER,updated_at_ms INTEGER);
|
|
CREATE TABLE spots(uuid TEXT PRIMARY KEY,domain_uuid TEXT,name TEXT,title TEXT,summary TEXT,path_prefix TEXT,state TEXT,created_at_ms INTEGER,updated_at_ms INTEGER);
|
|
CREATE TABLE street_spots(street_uuid TEXT,spot_uuid TEXT);
|
|
`)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := NewSQLite(database).EnsureSearchIndexSchema(); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|