# Block for inserting/upserting THX attributes into the thx table This block is responsible for inserting or updating THX-related records in the `thx` table using the same database configuration as `db_push_v1`. ## Table DDL The following DDL illustrates the `thx` table structure (Postgres style, conceptually compatible with DuckDB for tests): ```sql -- creating thx table CREATE TABLE IF NOT EXISTS thx ( application_key TEXT PRIMARY KEY, application_timestamp TIMESTAMP NULL, digital_id_first_seen TEXT NULL, summary_risk_score TEXT NULL, cpu_clock TEXT NULL, true_ip_first_seen TEXT NULL, ssn_hash TEXT NULL, ssn_hash_first_seen TEXT NULL, account_email_attributes TEXT NULL, tps_ip_latitude TEXT NULL, tps_ip_longitude TEXT NULL, account_telephone_first_seen TEXT NULL, account_login_first_seen TEXT NULL, input_ip_address TEXT NULL ); CREATE INDEX IF NOT EXISTS idx_thx_application_key ON thx(application_key); CREATE INDEX IF NOT EXISTS idx_thx_application_timestamp ON thx(application_timestamp); CREATE INDEX IF NOT EXISTS idx_thx_input_ip_address ON thx(input_ip_address); ``` For an existing table, apply the additive migration before deploying the block change: ```sql ALTER TABLE public.thx ADD COLUMN IF NOT EXISTS ssn_hash TEXT NULL, ADD COLUMN IF NOT EXISTS input_ip_address TEXT NULL; CREATE INDEX IF NOT EXISTS idx_thx_input_ip_address ON public.thx(input_ip_address); ```