Add view for detecting collisions

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 5f5d1aad93
commit 3f8b8eec1a
  1. 7
      archive/src/main/resources/org/openrs2/archive/V1__init.sql

@ -187,4 +187,11 @@ LEFT JOIN keys k ON k.id = c.key_id
GROUP BY v.master_index_id; GROUP BY v.master_index_id;
CREATE UNIQUE INDEX ON master_index_group_stats (master_index_id); CREATE UNIQUE INDEX ON master_index_group_stats (master_index_id);
CREATE VIEW collisions (archive_id, group_id, crc32, truncated_version, containers) AS
SELECT g.archive_id, g.group_id, c.crc32, g.version & 65535 AS truncated_version, COUNT(DISTINCT c.id)
FROM groups g
JOIN containers c ON c.id = g.container_id
GROUP BY g.archive_id, g.group_id, c.crc32, truncated_version
HAVING COUNT(DISTINCT c.id) > 1;
-- @formatter:on -- @formatter:on

Loading…
Cancel
Save