simple-web-app

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 278aaf6e9fe33219de6bd3088ebf2c379492d570
parent ca8ca659c1781c72163f5651586556fcd9c86168
Author: Silas Brack <silasbrack@gmail.com>
Date:   Fri, 12 Jun 2026 21:21:38 +0200

chore: remove leftover TrailBase files

Removes trailbase.nix (nix package definition) and traildepot/
(TrailBase config, migrations, data) which are no longer used.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Diffstat:
Dtrailbase.nix | 67-------------------------------------------------------------------
Dtraildepot/.gitignore | 8--------
Dtraildepot/config.textproto | 49-------------------------------------------------
Dtraildepot/metadata.textproto | 3---
Dtraildepot/migrations/main/U100__initial_schema.sql | 53-----------------------------------------------------
Dtraildepot/migrations/main/U101__hn_clone_schema.sql | 133-------------------------------------------------------------------------------
Dtraildepot/migrations/main/U102__fix_fts_content.sql | 41-----------------------------------------
Dtraildepot/migrations/main/U103__fts_porter_stemming.sql | 34----------------------------------
Dtraildepot/migrations/main/U104__story_indices.sql | 2--
Dtraildepot/wasm/search_guest.wasm | 0
10 files changed, 0 insertions(+), 390 deletions(-)

diff --git a/trailbase.nix b/trailbase.nix @@ -1,67 +0,0 @@ -{ lib -, stdenv -, fetchzip -, autoPatchelfHook -, zlib -, openssl -}: - -let - # Map Nix system to TrailBase release architecture - platformInfo = { - "x86_64-linux" = { - arch = "x86_64_linux"; - sha256 = "sha256-VOAYXtXdLlwrSJOi7g4pb8lLK5Atgz/ZxvRFt1qO9JA="; - }; - "aarch64-linux" = { - arch = "arm64_linux"; - sha256 = lib.fakeSha256; - }; - "x86_64-darwin" = { - arch = "x86_64_apple_darwin"; - sha256 = lib.fakeSha256; - }; - "aarch64-darwin" = { - arch = "arm64_apple_darwin"; - sha256 = "sha256-bUTGA9WJohFjhPXt5bOdBuy8z5TytWJ5hLJX2yMYvbM="; - }; - }; - - platform = platformInfo.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}"); -in -stdenv.mkDerivation rec { - pname = "trailbase"; - version = "0.28.3"; - - src = fetchzip { - url = "https://github.com/trailbaseio/trailbase/releases/download/v${version}/trailbase_v${version}_${platform.arch}.zip"; - sha256 = platform.sha256; - stripRoot = false; - }; - - nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; - - buildInputs = lib.optionals stdenv.isLinux [ - stdenv.cc.cc.lib - zlib - openssl - ]; - - installPhase = '' - runHook preInstall - - mkdir -p $out/bin - cp trail $out/bin/ - chmod +x $out/bin/trail - - runHook postInstall - ''; - - meta = with lib; { - description = "A blazingly fast, open-source application server built on Rust & SQLite"; - homepage = "https://github.com/trailbaseio/trailbase"; - license = licenses.osl3; - platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - maintainers = [ ]; - }; -} diff --git a/traildepot/.gitignore b/traildepot/.gitignore @@ -1,8 +0,0 @@ -data/ -backups/ -uploads/ -secrets/ -traildepot/ -*.db -*.db-wal -*.db-shm diff --git a/traildepot/config.textproto b/traildepot/config.textproto @@ -1,48 +0,0 @@ -# Auto-generated config.Config textproto -email {} -server { - application_name: "SimpleWebApp" - logs_retention_sec: 604800 -} -auth { - auth_token_ttl_sec: 3600 - refresh_token_ttl_sec: 2592000 -} -jobs {} -record_apis: [{ - name: "story" - table_name: "story" - acl_world: [READ] - acl_authenticated: [READ, CREATE, UPDATE, DELETE] - update_access_rule: "_ROW_.created_by = _USER_.id" - delete_access_rule: "_ROW_.created_by = _USER_.id" -}, { - name: "category" - table_name: "category" - acl_world: [READ] - acl_authenticated: [READ, CREATE] -}, { - name: "story_category" - table_name: "story_category" - acl_world: [READ] - acl_authenticated: [READ, CREATE, DELETE] -}, { - name: "comment" - table_name: "comment" - acl_world: [READ] - acl_authenticated: [READ, CREATE, UPDATE, DELETE] - update_access_rule: "_ROW_.created_by = _USER_.id" - delete_access_rule: "_ROW_.created_by = _USER_.id" - enable_subscriptions: true -}, { - name: "vote" - table_name: "vote" - acl_authenticated: [READ, CREATE, DELETE] - delete_access_rule: "_ROW_.user_id = _USER_.id" -}, { - name: "user_profile" - table_name: "user_profile" - acl_world: [READ] - acl_authenticated: [READ, CREATE, UPDATE] - update_access_rule: "_ROW_.user_id = _USER_.id" -}] -\ No newline at end of file diff --git a/traildepot/metadata.textproto b/traildepot/metadata.textproto @@ -1,2 +0,0 @@ -# Auto-generated metadata.Metadata textproto -last_executed_version: "v0.23.0-0-g65898fb" -\ No newline at end of file diff --git a/traildepot/migrations/main/U100__initial_schema.sql b/traildepot/migrations/main/U100__initial_schema.sql @@ -1,53 +0,0 @@ -CREATE TABLE category ( - 'id' INTEGER PRIMARY KEY NOT NULL, - 'name' TEXT -) STRICT; - -CREATE TABLE news_item ( - 'id' INTEGER PRIMARY KEY NOT NULL, - 'url' TEXT, - 'title' TEXT NOT NULL, - 'text' TEXT NOT NULL, - 'published' TEXT NOT NULL, - 'author' TEXT, - 'language' TEXT NOT NULL, - 'created_by' BLOB REFERENCES '_user'('id') -) STRICT; - -CREATE TABLE news_item_category ( - 'id' INTEGER PRIMARY KEY NOT NULL, - 'news_item_id' INTEGER NOT NULL REFERENCES 'news_item'('id'), - 'category_id' INTEGER NOT NULL REFERENCES 'category'('id') -) STRICT; - --- Full-text search -CREATE VIRTUAL TABLE news_item_fts USING fts5( - title, - text, - content='news_item', - content_rowid='id' -); - -CREATE TRIGGER news_item_ai AFTER INSERT ON news_item BEGIN - INSERT INTO news_item_fts(rowid, title, text) - VALUES (new.id, new.title, new.text); -END; - -CREATE TRIGGER news_item_au AFTER UPDATE ON news_item BEGIN - UPDATE news_item_fts SET title=new.title, text=new.text - WHERE rowid=old.id; -END; - -CREATE TRIGGER news_item_ad AFTER DELETE ON news_item BEGIN - DELETE FROM news_item_fts WHERE rowid=old.id; -END; - --- View for news with categories -CREATE VIEW news_with_categories AS -SELECT - n.*, - GROUP_CONCAT(c.name) as category_names -FROM news_item n -LEFT JOIN news_item_category nc ON nc.news_item_id = n.id -LEFT JOIN category c ON c.id = nc.category_id -GROUP BY n.id; diff --git a/traildepot/migrations/main/U101__hn_clone_schema.sql b/traildepot/migrations/main/U101__hn_clone_schema.sql @@ -1,133 +0,0 @@ --- HN/Lobsters Clone Schema Migration --- Refactor news aggregator to community-driven link aggregator - --- Rename news_item to story and add scoring columns -ALTER TABLE news_item RENAME TO story; -ALTER TABLE story ADD COLUMN score INTEGER NOT NULL DEFAULT 1; -ALTER TABLE story ADD COLUMN comment_count INTEGER NOT NULL DEFAULT 0; -ALTER TABLE story ADD COLUMN domain TEXT; - --- Update FTS triggers to reference story table -DROP TRIGGER IF EXISTS news_item_ai; -DROP TRIGGER IF EXISTS news_item_au; -DROP TRIGGER IF EXISTS news_item_ad; - -CREATE TRIGGER story_ai AFTER INSERT ON story BEGIN - INSERT INTO news_item_fts(rowid, title, text) - VALUES (new.id, new.title, new.text); -END; - -CREATE TRIGGER story_au AFTER UPDATE ON story BEGIN - UPDATE news_item_fts SET title=new.title, text=new.text - WHERE rowid=old.id; -END; - -CREATE TRIGGER story_ad AFTER DELETE ON story BEGIN - DELETE FROM news_item_fts WHERE rowid=old.id; -END; - --- Comments with materialized path for threading -CREATE TABLE comment ( - id INTEGER PRIMARY KEY NOT NULL, - story_id INTEGER NOT NULL REFERENCES story(id) ON DELETE CASCADE, - parent_id INTEGER REFERENCES comment(id) ON DELETE CASCADE, - path TEXT NOT NULL, -- "1.5.12" = hierarchy - depth INTEGER NOT NULL DEFAULT 0, - text TEXT NOT NULL, - score INTEGER NOT NULL DEFAULT 0, - created_at TEXT NOT NULL DEFAULT (datetime('now')), - created_by BLOB NOT NULL REFERENCES _user(id) -) STRICT; - -CREATE INDEX idx_comment_story_id ON comment(story_id); -CREATE INDEX idx_comment_parent_id ON comment(parent_id); -CREATE INDEX idx_comment_path ON comment(path); - --- Votes (stories + comments) -CREATE TABLE vote ( - id INTEGER PRIMARY KEY NOT NULL, - user_id BLOB NOT NULL REFERENCES _user(id), - target_type INTEGER NOT NULL, -- 1=story, 2=comment - target_id INTEGER NOT NULL, - created_at TEXT NOT NULL DEFAULT (datetime('now')), - UNIQUE(user_id, target_type, target_id) -) STRICT; - -CREATE INDEX idx_vote_user ON vote(user_id); -CREATE INDEX idx_vote_target ON vote(target_type, target_id); - --- User profiles -CREATE TABLE user_profile ( - id INTEGER PRIMARY KEY NOT NULL, - user_id BLOB NOT NULL UNIQUE REFERENCES _user(id), - username TEXT NOT NULL UNIQUE, - about TEXT, - karma INTEGER NOT NULL DEFAULT 0, - created_at TEXT NOT NULL DEFAULT (datetime('now')) -) STRICT; - -CREATE INDEX idx_user_profile_username ON user_profile(username); - --- Rename junction table -ALTER TABLE news_item_category RENAME TO story_category; - --- Drop old view and create new one -DROP VIEW IF EXISTS news_with_categories; - -CREATE VIEW story_with_categories AS -SELECT - s.*, - GROUP_CONCAT(c.name) as category_names -FROM story s -LEFT JOIN story_category sc ON sc.news_item_id = s.id -LEFT JOIN category c ON c.id = sc.category_id -GROUP BY s.id; - --- Triggers for auto-updating comment_count on story -CREATE TRIGGER comment_insert_count AFTER INSERT ON comment -BEGIN - UPDATE story SET comment_count = comment_count + 1 WHERE id = new.story_id; -END; - -CREATE TRIGGER comment_delete_count AFTER DELETE ON comment -BEGIN - UPDATE story SET comment_count = comment_count - 1 WHERE id = old.story_id; -END; - --- Triggers for auto-updating scores on vote insert/delete for stories -CREATE TRIGGER vote_insert_story AFTER INSERT ON vote -WHEN new.target_type = 1 -BEGIN - UPDATE story SET score = score + 1 WHERE id = new.target_id; - -- Update karma for story author - UPDATE user_profile SET karma = karma + 1 - WHERE user_id = (SELECT created_by FROM story WHERE id = new.target_id); -END; - -CREATE TRIGGER vote_delete_story AFTER DELETE ON vote -WHEN old.target_type = 1 -BEGIN - UPDATE story SET score = score - 1 WHERE id = old.target_id; - -- Update karma for story author - UPDATE user_profile SET karma = karma - 1 - WHERE user_id = (SELECT created_by FROM story WHERE id = old.target_id); -END; - --- Triggers for auto-updating scores on vote insert/delete for comments -CREATE TRIGGER vote_insert_comment AFTER INSERT ON vote -WHEN new.target_type = 2 -BEGIN - UPDATE comment SET score = score + 1 WHERE id = new.target_id; - -- Update karma for comment author - UPDATE user_profile SET karma = karma + 1 - WHERE user_id = (SELECT created_by FROM comment WHERE id = new.target_id); -END; - -CREATE TRIGGER vote_delete_comment AFTER DELETE ON vote -WHEN old.target_type = 2 -BEGIN - UPDATE comment SET score = score - 1 WHERE id = old.target_id; - -- Update karma for comment author - UPDATE user_profile SET karma = karma - 1 - WHERE user_id = (SELECT created_by FROM comment WHERE id = old.target_id); -END; diff --git a/traildepot/migrations/main/U102__fix_fts_content.sql b/traildepot/migrations/main/U102__fix_fts_content.sql @@ -1,41 +0,0 @@ --- Fix FTS5 content table reference --- The news_item_fts table was created with content='news_item' but we renamed to 'story' - --- Drop the old FTS table and related tables -DROP TABLE IF EXISTS news_item_fts; -DROP TABLE IF EXISTS news_item_fts_data; -DROP TABLE IF EXISTS news_item_fts_idx; -DROP TABLE IF EXISTS news_item_fts_docsize; -DROP TABLE IF EXISTS news_item_fts_config; - --- Drop the triggers that reference the old FTS table -DROP TRIGGER IF EXISTS story_ai; -DROP TRIGGER IF EXISTS story_au; -DROP TRIGGER IF EXISTS story_ad; - --- Create new FTS table with correct content reference -CREATE VIRTUAL TABLE story_fts USING fts5( - title, - text, - content='story', - content_rowid='id' -); - --- Populate the FTS table with existing data -INSERT INTO story_fts(rowid, title, text) -SELECT id, title, text FROM story; - --- Create triggers for the new FTS table -CREATE TRIGGER story_ai AFTER INSERT ON story BEGIN - INSERT INTO story_fts(rowid, title, text) - VALUES (new.id, new.title, new.text); -END; - -CREATE TRIGGER story_au AFTER UPDATE ON story BEGIN - UPDATE story_fts SET title=new.title, text=new.text - WHERE rowid=old.id; -END; - -CREATE TRIGGER story_ad AFTER DELETE ON story BEGIN - DELETE FROM story_fts WHERE rowid=old.id; -END; diff --git a/traildepot/migrations/main/U103__fts_porter_stemming.sql b/traildepot/migrations/main/U103__fts_porter_stemming.sql @@ -1,34 +0,0 @@ --- Add porter stemming to FTS5 for better search matching - -DROP TABLE IF EXISTS story_fts; - -CREATE VIRTUAL TABLE story_fts USING fts5( - title, - text, - content='story', - content_rowid='id', - tokenize='porter unicode61' -); - --- Repopulate with existing data -INSERT INTO story_fts(rowid, title, text) -SELECT id, title, text FROM story; - --- Recreate triggers -DROP TRIGGER IF EXISTS story_ai; -DROP TRIGGER IF EXISTS story_au; -DROP TRIGGER IF EXISTS story_ad; - -CREATE TRIGGER story_ai AFTER INSERT ON story BEGIN - INSERT INTO story_fts(rowid, title, text) - VALUES (new.id, new.title, new.text); -END; - -CREATE TRIGGER story_au AFTER UPDATE ON story BEGIN - UPDATE story_fts SET title=new.title, text=new.text - WHERE rowid=old.id; -END; - -CREATE TRIGGER story_ad AFTER DELETE ON story BEGIN - DELETE FROM story_fts WHERE rowid=old.id; -END; diff --git a/traildepot/migrations/main/U104__story_indices.sql b/traildepot/migrations/main/U104__story_indices.sql @@ -1,2 +0,0 @@ -CREATE INDEX IF NOT EXISTS idx_story_published ON story (published DESC); -CREATE INDEX IF NOT EXISTS idx_story_score ON story (score DESC, published DESC); diff --git a/traildepot/wasm/search_guest.wasm b/traildepot/wasm/search_guest.wasm Binary files differ.