-- D1 schema for the jobsdb snapshot (documents/postings/jobs.db). Applied first by -- scripts/import-postings.ts as .import/0000-schema.sql; idempotent. -- -- `postings` mirrors the source table column-for-column (all TEXT). `companies` -- carries only what src/portals/jobsdb.ts reads. `postings_fts` is a -- self-contained FTS5 table (not external-content: those need the shadow -- tables, which `wrangler d1 execute --file` cannot bulk-load sanely), joined -- on posting_id rather than rowid. CREATE TABLE IF NOT EXISTS postings ( posting_id TEXT PRIMARY KEY, company_id TEXT, company_name TEXT, company_domain TEXT, title TEXT, department TEXT, function TEXT, seniority TEXT, posted_date TEXT, location_text TEXT, remote_policy_stated TEXT, location_class TEXT, location_country TEXT, salary_min TEXT, salary_max TEXT, salary_currency TEXT, url TEXT, source_ats TEXT, source_tier TEXT, scrape_timestamp TEXT, classification_rationale TEXT ); CREATE TABLE IF NOT EXISTS companies ( company_id TEXT PRIMARY KEY, name TEXT, target_sector TEXT, crypto_native TEXT, priority_tier INTEGER, homepage_domain TEXT ); CREATE INDEX IF NOT EXISTS postings_company_id ON postings(company_id); CREATE INDEX IF NOT EXISTS postings_location_class ON postings(location_class); CREATE INDEX IF NOT EXISTS postings_seniority ON postings(seniority); CREATE VIRTUAL TABLE IF NOT EXISTS postings_fts USING fts5(posting_id UNINDEXED, title, company_name, location_text);