Add THX input IP persistence
This commit is contained in:
parent
703aab6a33
commit
62ed938d62
13
README.md
13
README.md
@ -20,10 +20,21 @@ CREATE TABLE IF NOT EXISTS thx (
|
|||||||
tps_ip_latitude TEXT NULL,
|
tps_ip_latitude TEXT NULL,
|
||||||
tps_ip_longitude TEXT NULL,
|
tps_ip_longitude TEXT NULL,
|
||||||
account_telephone_first_seen 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_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_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);
|
||||||
|
```
|
||||||
|
|||||||
10
main.sql
10
main.sql
@ -10,7 +10,8 @@ INSERT INTO public.thx (
|
|||||||
tps_ip_latitude,
|
tps_ip_latitude,
|
||||||
tps_ip_longitude,
|
tps_ip_longitude,
|
||||||
account_telephone_first_seen,
|
account_telephone_first_seen,
|
||||||
account_login_first_seen
|
account_login_first_seen,
|
||||||
|
input_ip_address
|
||||||
)
|
)
|
||||||
VALUES (
|
VALUES (
|
||||||
$application_key,
|
$application_key,
|
||||||
@ -24,7 +25,8 @@ VALUES (
|
|||||||
$tps_ip_latitude,
|
$tps_ip_latitude,
|
||||||
$tps_ip_longitude,
|
$tps_ip_longitude,
|
||||||
$account_telephone_first_seen,
|
$account_telephone_first_seen,
|
||||||
$account_login_first_seen
|
$account_login_first_seen,
|
||||||
|
$input_ip_address
|
||||||
)
|
)
|
||||||
ON CONFLICT (application_key)
|
ON CONFLICT (application_key)
|
||||||
DO UPDATE
|
DO UPDATE
|
||||||
@ -38,5 +40,5 @@ DO UPDATE
|
|||||||
tps_ip_latitude = EXCLUDED.tps_ip_latitude,
|
tps_ip_latitude = EXCLUDED.tps_ip_latitude,
|
||||||
tps_ip_longitude = EXCLUDED.tps_ip_longitude,
|
tps_ip_longitude = EXCLUDED.tps_ip_longitude,
|
||||||
account_telephone_first_seen = EXCLUDED.account_telephone_first_seen,
|
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;
|
||||||
|
|||||||
@ -38,6 +38,9 @@
|
|||||||
},
|
},
|
||||||
"account_login_first_seen": {
|
"account_login_first_seen": {
|
||||||
"type": ["string", "null"]
|
"type": ["string", "null"]
|
||||||
|
},
|
||||||
|
"input_ip_address": {
|
||||||
|
"type": ["string", "null"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
@ -45,4 +48,3 @@
|
|||||||
"application_timestamp"
|
"application_timestamp"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user