summaryrefslogtreecommitdiff
path: root/src/schema.sql
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-07-04 20:19:34 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2026-07-04 20:19:34 +0100
commit870aa90c005f77a73445f5c39f9fd9bbb7604fe8 (patch)
tree21597011d909436aeb94da228dee07da0309cc15 /src/schema.sql
parent61e106fe6a15f76b73125682e91d5c17ee875be2 (diff)
downloadwebstat-870aa90c005f77a73445f5c39f9fd9bbb7604fe8.tar.bz2
webstat-870aa90c005f77a73445f5c39f9fd9bbb7604fe8.tar.xz
webstat-870aa90c005f77a73445f5c39f9fd9bbb7604fe8.zip
Insert uninsirtable lines using the hostnameId recorded in the bad_lines table
Includes the same fix from the previous commit which stops caching entities until the inserts are complete. Updates storeLogLine to take an insert command with the hostnameId already bound.
Diffstat (limited to 'src/schema.sql')
-rw-r--r--src/schema.sql3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/schema.sql b/src/schema.sql
index 40cab51..fd2f3c5 100644
--- a/src/schema.sql
+++ b/src/schema.sql
@@ -94,6 +94,9 @@ CREATE INDEX idx_entities_retryinsert ON bad_lines(id)
WHERE
type = 'uninsertable_line' AND detail ->> 'retriedAt' IS NULL;
+ALTER TABLE bad_lines
+ ADD CONSTRAINT bad_lines_have_hostnameid CHECK (detail ? 'hostnameId');
+
CREATE OR REPLACE FUNCTION entity(newValue text, newType entity)
RETURNS TABLE(
id integer,