Phase 2 part 2: prospects, the review screen and the suppression list
Schema 6 adds prospect_companies, prospect_contacts (merged by domain and email, each with its source, detail and date) and suppressions. Prospects -> Review lists New, Accepted and Set aside: accepting a company queues an EspoCRM Account, a person a Lead at their company, with provenance and why they fit in the description; the page warns about records already in the CRM as of the last sync, and shows each accepted prospect's CRM progress. Prospects can be added by hand. The suppression list (emails and domains) is checked on add and again before queueing, and suppressing sets matching new prospects aside. Search finds prospects too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -166,6 +166,60 @@ CREATE TABLE crm_records (
|
||||
);
|
||||
CREATE INDEX crm_records_by_email ON crm_records (email);
|
||||
CREATE INDEX crm_records_by_domain ON crm_records (domain);
|
||||
`,
|
||||
// 6: prospects. Companies and people Supermarket found (or the user
|
||||
// added), waiting for review; nothing reaches the CRM until accepted.
|
||||
// Every one records where and when it was found.
|
||||
`
|
||||
CREATE TABLE prospect_companies (
|
||||
id INTEGER PRIMARY KEY,
|
||||
name TEXT NOT NULL,
|
||||
domain TEXT NOT NULL DEFAULT '' COLLATE NOCASE, -- one company per domain
|
||||
website TEXT NOT NULL DEFAULT '',
|
||||
linkedin TEXT NOT NULL DEFAULT '',
|
||||
industry TEXT NOT NULL DEFAULT '',
|
||||
size TEXT NOT NULL DEFAULT '',
|
||||
location TEXT NOT NULL DEFAULT '',
|
||||
why TEXT NOT NULL DEFAULT '', -- why it fits the targets
|
||||
source TEXT NOT NULL, -- manual, discovery, hunter, csv…
|
||||
source_detail TEXT NOT NULL DEFAULT '', -- a URL or note: where exactly
|
||||
found_at TEXT NOT NULL,
|
||||
status TEXT NOT NULL DEFAULT 'new', -- new, accepted, rejected
|
||||
decided_at TEXT,
|
||||
action_id INTEGER -- the CRM action that adds it as an Account
|
||||
);
|
||||
CREATE UNIQUE INDEX prospect_companies_by_domain ON prospect_companies (domain) WHERE domain != '';
|
||||
CREATE INDEX prospect_companies_by_status ON prospect_companies (status, id);
|
||||
|
||||
CREATE TABLE prospect_contacts (
|
||||
id INTEGER PRIMARY KEY,
|
||||
company_id INTEGER REFERENCES prospect_companies (id) ON DELETE SET NULL,
|
||||
first_name TEXT NOT NULL DEFAULT '',
|
||||
last_name TEXT NOT NULL DEFAULT '',
|
||||
title TEXT NOT NULL DEFAULT '',
|
||||
email TEXT NOT NULL DEFAULT '' COLLATE NOCASE, -- one contact per email
|
||||
email_status TEXT NOT NULL DEFAULT '', -- '', valid, risky, invalid (from verification)
|
||||
linkedin TEXT NOT NULL DEFAULT '',
|
||||
phone TEXT NOT NULL DEFAULT '',
|
||||
source TEXT NOT NULL,
|
||||
source_detail TEXT NOT NULL DEFAULT '',
|
||||
found_at TEXT NOT NULL,
|
||||
status TEXT NOT NULL DEFAULT 'new', -- new, accepted, rejected
|
||||
decided_at TEXT,
|
||||
action_id INTEGER -- the CRM action that adds them as a Lead
|
||||
);
|
||||
CREATE UNIQUE INDEX prospect_contacts_by_email ON prospect_contacts (email) WHERE email != '';
|
||||
CREATE INDEX prospect_contacts_by_company ON prospect_contacts (company_id);
|
||||
|
||||
-- People and companies who must never be contacted or added: checked
|
||||
-- before anything is found, shown or queued.
|
||||
CREATE TABLE suppressions (
|
||||
kind TEXT NOT NULL, -- email or domain
|
||||
value TEXT NOT NULL COLLATE NOCASE,
|
||||
reason TEXT NOT NULL DEFAULT '',
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
||||
PRIMARY KEY (kind, value)
|
||||
);
|
||||
`,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user