diff --git a/README.md b/README.md index 792658c..8e04b0d 100644 --- a/README.md +++ b/README.md @@ -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); +``` diff --git a/main.sql b/main.sql index d3a5965..373abe1 100644 --- a/main.sql +++ b/main.sql @@ -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; diff --git a/request_schema.json b/request_schema.json index bd368e2..2418119 100644 --- a/request_schema.json +++ b/request_schema.json @@ -38,6 +38,9 @@ }, "account_login_first_seen": { "type": ["string", "null"] + }, + "input_ip_address": { + "type": ["string", "null"] } }, "required": [ @@ -45,4 +48,3 @@ "application_timestamp" ] } -