refactor(tenant): drop legacy plugin_installations, migrate monitoring to desktop_clients

Hard cutover from the browser-extension plugin flow to desktop clients:
remove plugin_installations/plugin_sessions tables and related service,
handler, router, and generated model code; migrate monitoring quotas
and collector types to desktop_clients (UUID primary_client_id);
recreate platform_access_snapshots keyed by client_id; update dev-seed
and callback types accordingly; mark legacy design docs as historical.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-20 13:52:35 +08:00
parent f5a1cd81b2
commit 5ff2e2e74c
25 changed files with 535 additions and 1384 deletions
@@ -21,7 +21,7 @@ CREATE INDEX idx_monitoring_question_snapshot_active
CREATE TABLE monitoring_platform_access_snapshots (
id BIGSERIAL PRIMARY KEY,
tenant_id BIGINT NOT NULL,
installation_id BIGINT NOT NULL,
client_id UUID NOT NULL,
ai_platform_id VARCHAR(30) NOT NULL,
business_date DATE NOT NULL,
access_status VARCHAR(20) NOT NULL,
@@ -32,7 +32,7 @@ CREATE TABLE monitoring_platform_access_snapshots (
reason_message TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT uk_platform_access_snapshot UNIQUE (tenant_id, installation_id, ai_platform_id, business_date)
CONSTRAINT uk_platform_access_snapshot UNIQUE (tenant_id, client_id, ai_platform_id, business_date)
);
CREATE INDEX idx_platform_access_snapshot_lookup
@@ -45,9 +45,9 @@ CREATE TABLE monitoring_collect_tasks (
question_id BIGINT NOT NULL,
question_hash BYTEA NOT NULL,
ai_platform_id VARCHAR(30) NOT NULL,
collector_type VARCHAR(20) NOT NULL DEFAULT 'plugin',
collector_type VARCHAR(20) NOT NULL DEFAULT 'desktop',
trigger_source VARCHAR(20) NOT NULL DEFAULT 'automatic',
run_mode VARCHAR(30) NOT NULL DEFAULT 'plugin_standard',
run_mode VARCHAR(30) NOT NULL DEFAULT 'desktop_standard',
business_date DATE NOT NULL,
planned_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
status VARCHAR(20) NOT NULL DEFAULT 'pending',
@@ -77,9 +77,9 @@ CREATE TABLE question_monitor_runs (
question_text_snapshot TEXT NOT NULL,
question_hash BYTEA NOT NULL,
ai_platform_id VARCHAR(30) NOT NULL,
collector_type VARCHAR(20) NOT NULL DEFAULT 'plugin',
collector_type VARCHAR(20) NOT NULL DEFAULT 'desktop',
trigger_source VARCHAR(20) NOT NULL DEFAULT 'automatic',
run_mode VARCHAR(30) NOT NULL DEFAULT 'plugin_standard',
run_mode VARCHAR(30) NOT NULL DEFAULT 'desktop_standard',
business_date DATE NOT NULL,
provider_model VARCHAR(100),
provider_request_id VARCHAR(100),
@@ -187,7 +187,7 @@ CREATE TABLE monitoring_brand_daily (
id BIGSERIAL PRIMARY KEY,
tenant_id BIGINT NOT NULL,
brand_id BIGINT NOT NULL,
collector_type VARCHAR(20) NOT NULL DEFAULT 'plugin',
collector_type VARCHAR(20) NOT NULL DEFAULT 'desktop',
business_date DATE NOT NULL,
sample_status VARCHAR(20) NOT NULL,
desired_sample_count INT NOT NULL DEFAULT 0,
@@ -221,7 +221,7 @@ CREATE TABLE monitoring_brand_platform_daily (
tenant_id BIGINT NOT NULL,
brand_id BIGINT NOT NULL,
ai_platform_id VARCHAR(30) NOT NULL,
collector_type VARCHAR(20) NOT NULL DEFAULT 'plugin',
collector_type VARCHAR(20) NOT NULL DEFAULT 'desktop',
business_date DATE NOT NULL,
platform_sample_status VARCHAR(20) NOT NULL,
planned_sample_count INT NOT NULL DEFAULT 0,