Rename master_index_entries to master_index_archives

This naming is a bit more consistent with the index_groups and
index_files tables.

Signed-off-by: Graham <gpe@openrs2.org>
Graham 4 years ago
parent 0b00c8452a
commit a3593e9326
  1. 10
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheExporter.kt
  2. 2
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt
  3. 2
      archive/src/main/resources/org/openrs2/archive/V1__init.sql

@ -20,12 +20,12 @@ public class CacheExporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
WITH t AS ( WITH t AS (
SELECT e.archive_id, c.data, g.container_id SELECT a.archive_id, c.data, g.container_id
FROM master_indexes m FROM master_indexes m
JOIN master_index_entries e ON e.container_id = m.container_id JOIN master_index_archives a ON a.container_id = m.container_id
JOIN groups g ON g.archive_id = 255 AND g.group_id = e.archive_id::INTEGER AND g.truncated_version = e.version & 65535 JOIN groups g ON g.archive_id = 255 AND g.group_id = a.archive_id::INTEGER AND g.truncated_version = a.version & 65535
JOIN containers c ON c.id = g.container_id AND c.crc32 = e.crc32 JOIN containers c ON c.id = g.container_id AND c.crc32 = a.crc32
JOIN indexes i ON i.container_id = g.container_id AND i.version = e.version JOIN indexes i ON i.container_id = g.container_id AND i.version = a.version
WHERE m.container_id = ? WHERE m.container_id = ?
) )
SELECT 255::uint1, t.archive_id::INTEGER, t.data, NULL SELECT 255::uint1, t.archive_id::INTEGER, t.data, NULL

@ -339,7 +339,7 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement( connection.prepareStatement(
""" """
INSERT INTO master_index_entries (container_id, archive_id, crc32, version) INSERT INTO master_index_archives (container_id, archive_id, crc32, version)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?)
""".trimIndent() """.trimIndent()
).use { stmt -> ).use { stmt ->

@ -89,7 +89,7 @@ CREATE TABLE master_indexes (
timestamp TIMESTAMPTZ NULL timestamp TIMESTAMPTZ NULL
); );
CREATE TABLE master_index_entries ( CREATE TABLE master_index_archives (
container_id BIGINT NOT NULL REFERENCES master_indexes (container_id), container_id BIGINT NOT NULL REFERENCES master_indexes (container_id),
archive_id uint1 NOT NULL, archive_id uint1 NOT NULL,
crc32 INTEGER NOT NULL, crc32 INTEGER NOT NULL,

Loading…
Cancel
Save