add public contact extraction
This commit is contained in:
@@ -188,3 +188,27 @@ CREATE TABLE IF NOT EXISTS website_scans (
|
||||
CREATE INDEX IF NOT EXISTS idx_website_scans_org ON website_scans(organization_id,created_at DESC,id DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_website_scans_business ON website_scans(organization_id,business_id,created_at DESC,id DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_website_scans_cache ON website_scans(organization_id,cache_key,cache_expires_at);
|
||||
|
||||
-- Phase 9 contact extraction provenance. MX is intentionally a state value, not a probe.
|
||||
CREATE TABLE IF NOT EXISTS contact_extractions (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
organization_id TEXT NOT NULL REFERENCES organizations(id),
|
||||
business_id INTEGER NOT NULL REFERENCES businesses(id) ON DELETE CASCADE,
|
||||
website_scan_id INTEGER REFERENCES website_scans(id) ON DELETE SET NULL,
|
||||
extraction_key TEXT NOT NULL,
|
||||
kind TEXT NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
label TEXT NOT NULL DEFAULT '',
|
||||
classification TEXT NOT NULL DEFAULT 'unknown',
|
||||
confidence REAL NOT NULL DEFAULT 0,
|
||||
source_url TEXT NOT NULL,
|
||||
public_business INTEGER NOT NULL DEFAULT 1,
|
||||
mx_status TEXT NOT NULL DEFAULT 'unknown',
|
||||
suppressed INTEGER NOT NULL DEFAULT 0,
|
||||
do_not_contact INTEGER NOT NULL DEFAULT 0,
|
||||
provenance TEXT NOT NULL DEFAULT '',
|
||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(organization_id,business_id,extraction_key,kind,value)
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_contact_extractions_org ON contact_extractions(organization_id,created_at DESC,id DESC);
|
||||
CREATE INDEX IF NOT EXISTS idx_contact_extractions_business ON contact_extractions(organization_id,business_id,id DESC);
|
||||
|
||||
Reference in New Issue
Block a user