felt/internal/store/migrations/002_fts_indexes.sql
Mikkel Georgsen af13732b2b feat(01-01): initialize Go module, dependency tree, and project scaffold
- Go module at github.com/felt-app/felt with go-libsql pinned to commit hash
- Full directory structure per research recommendations (cmd/leaf, internal/*, frontend/)
- Makefile with build, run, run-dev, test, frontend, all, clean targets
- LibSQL database with WAL mode, foreign keys, and embedded migration runner
- SvelteKit SPA stub served via go:embed
- Package stubs for all internal packages (server, nats, store, auth, clock, etc.)
- go build and go vet pass cleanly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 03:34:44 +01:00

28 lines
1 KiB
SQL

-- 002_fts_indexes.sql
-- FTS5 virtual table for player typeahead search
-- Synced with players table via triggers
CREATE VIRTUAL TABLE IF NOT EXISTS players_fts USING fts5(
name, nickname, email,
content='players',
content_rowid='rowid'
);
-- Sync triggers: keep FTS index up to date with players table
CREATE TRIGGER IF NOT EXISTS players_ai AFTER INSERT ON players BEGIN
INSERT INTO players_fts(rowid, name, nickname, email)
VALUES (new.rowid, new.name, new.nickname, new.email);
END;
CREATE TRIGGER IF NOT EXISTS players_ad AFTER DELETE ON players BEGIN
INSERT INTO players_fts(players_fts, rowid, name, nickname, email)
VALUES ('delete', old.rowid, old.name, old.nickname, old.email);
END;
CREATE TRIGGER IF NOT EXISTS players_au AFTER UPDATE ON players BEGIN
INSERT INTO players_fts(players_fts, rowid, name, nickname, email)
VALUES ('delete', old.rowid, old.name, old.nickname, old.email);
INSERT INTO players_fts(rowid, name, nickname, email)
VALUES (new.rowid, new.name, new.nickname, new.email);
END;