Add THX input IP persistence
All checks were successful
Build and Push Docker Image / setup (push) Successful in 5s
Build and Push Docker Image / build_and_push (push) Successful in 45s

This commit is contained in:
Ankur Malik 2026-05-20 13:28:37 -04:00
parent 703aab6a33
commit 62ed938d62
3 changed files with 21 additions and 6 deletions

View File

@ -20,10 +20,21 @@ CREATE TABLE IF NOT EXISTS thx (
tps_ip_latitude TEXT NULL,
tps_ip_longitude TEXT NULL,
account_telephone_first_seen TEXT NULL,
account_login_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 input_ip_address TEXT NULL;
CREATE INDEX IF NOT EXISTS idx_thx_input_ip_address
ON public.thx(input_ip_address);
```

View File

@ -10,7 +10,8 @@ INSERT INTO public.thx (
tps_ip_latitude,
tps_ip_longitude,
account_telephone_first_seen,
account_login_first_seen
account_login_first_seen,
input_ip_address
)
VALUES (
$application_key,
@ -24,7 +25,8 @@ VALUES (
$tps_ip_latitude,
$tps_ip_longitude,
$account_telephone_first_seen,
$account_login_first_seen
$account_login_first_seen,
$input_ip_address
)
ON CONFLICT (application_key)
DO UPDATE
@ -38,5 +40,5 @@ DO UPDATE
tps_ip_latitude = EXCLUDED.tps_ip_latitude,
tps_ip_longitude = EXCLUDED.tps_ip_longitude,
account_telephone_first_seen = EXCLUDED.account_telephone_first_seen,
account_login_first_seen = EXCLUDED.account_login_first_seen;
account_login_first_seen = EXCLUDED.account_login_first_seen,
input_ip_address = EXCLUDED.input_ip_address;

View File

@ -38,6 +38,9 @@
},
"account_login_first_seen": {
"type": ["string", "null"]
},
"input_ip_address": {
"type": ["string", "null"]
}
},
"required": [
@ -45,4 +48,3 @@
"application_timestamp"
]
}