diff options
| -rw-r--r-- | src/schema.sql | 2 | ||||
| -rw-r--r-- | src/sql/hostUpsert.sql | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/schema.sql b/src/schema.sql index 6f28f2d..0062538 100644 --- a/src/schema.sql +++ b/src/schema.sql @@ -40,7 +40,7 @@ CREATE TABLE entities( CONSTRAINT pk_entities PRIMARY KEY (id) ); -CREATE UNIQUE INDEX uni_entities_value ON entities(MD5(value)); +CREATE UNIQUE INDEX uni_entities_value ON entities(MD5(value), type); CREATE INDEX idx_entities_retryinsert ON entities(id) WHERE diff --git a/src/sql/hostUpsert.sql b/src/sql/hostUpsert.sql index d5ee11d..5c8be1e 100644 --- a/src/sql/hostUpsert.sql +++ b/src/sql/hostUpsert.sql @@ -1,7 +1,7 @@ INSERT INTO entities(type, value, detail) VALUES ('host', $1, jsonb_build_object('sysname', $2::text, 'release', $3::text, 'version', $4::text, 'machine', $5::text, 'domainname', $6::text)) -ON CONFLICT (md5(value)) +ON CONFLICT (md5(value), type) DO UPDATE SET detail = jsonb_build_object('sysname', $2::text, 'release', $3::text, 'version', $4::text, 'machine', $5::text, 'domainname', $6::text) |
