18 lines
791 B
SQL
18 lines
791 B
SQL
-- 014: OFAC screening logs (compliance-service)
|
|
CREATE TABLE IF NOT EXISTS ofac_screenings (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
user_id UUID REFERENCES users(id),
|
|
screen_type VARCHAR(20) NOT NULL CHECK (screen_type IN ('registration', 'transaction', 'periodic')),
|
|
name_screened VARCHAR(200),
|
|
address_screened VARCHAR(42),
|
|
is_match BOOLEAN NOT NULL DEFAULT false,
|
|
match_score NUMERIC(5,2),
|
|
match_details JSONB,
|
|
action_taken VARCHAR(20) CHECK (action_taken IN ('none', 'freeze', 'report', 'block')),
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
|
);
|
|
|
|
CREATE INDEX idx_ofac_user_id ON ofac_screenings(user_id);
|
|
CREATE INDEX idx_ofac_is_match ON ofac_screenings(is_match);
|
|
CREATE INDEX idx_ofac_created_at ON ofac_screenings(created_at DESC);
|