42 lines
1.6 KiB
SQL
Executable file
42 lines
1.6 KiB
SQL
Executable file
-- Conversation Assistant Schema for E2E Tests
|
|
-- Creates scammer_profiles, training_samples, and training_jobs tables
|
|
|
|
-- Scammer profiles table
|
|
CREATE TABLE IF NOT EXISTS scammer_profiles (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
phone_number VARCHAR(50) NOT NULL UNIQUE,
|
|
status VARCHAR(20) NOT NULL CHECK (status IN ('suspected', 'confirmed', 'cleared', 'under_review')),
|
|
risk_score DECIMAL(5,2) NOT NULL DEFAULT 0,
|
|
ai_detected_count INTEGER NOT NULL DEFAULT 0,
|
|
manipulation_count INTEGER NOT NULL DEFAULT 0,
|
|
phishing_count INTEGER NOT NULL DEFAULT 0,
|
|
notes TEXT,
|
|
first_seen TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
last_seen TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
-- Indexes for scammer queries
|
|
CREATE INDEX IF NOT EXISTS "IDX_scammer_profiles_phone" ON scammer_profiles(phone_number);
|
|
CREATE INDEX IF NOT EXISTS "IDX_scammer_profiles_status" ON scammer_profiles(status);
|
|
|
|
-- Training samples table
|
|
CREATE TABLE IF NOT EXISTS training_samples (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
input_context TEXT NOT NULL,
|
|
expected_output TEXT NOT NULL,
|
|
is_approved BOOLEAN NOT NULL DEFAULT false,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
-- Training jobs table
|
|
CREATE TABLE IF NOT EXISTS training_jobs (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
base_model_id VARCHAR(255) NOT NULL,
|
|
status VARCHAR(20) NOT NULL DEFAULT 'pending' CHECK (status IN ('pending', 'running', 'completed', 'failed')),
|
|
current_epoch INTEGER,
|
|
total_epochs INTEGER NOT NULL DEFAULT 3,
|
|
loss FLOAT,
|
|
started_at TIMESTAMPTZ,
|
|
completed_at TIMESTAMPTZ,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|