Store index protocol, version and flags in the database

Although it isn't necessary, we might as well as it doesn't take up much
extra space and we already store all the properties for all groups and
files.

Signed-off-by: Graham <gpe@openrs2.org>
pull/132/head
Graham 3 years ago
parent 1c061c0f66
commit 97640774f9
  1. 12
      archive/src/main/kotlin/org/openrs2/archive/cache/CacheImporter.kt
  2. 8
      archive/src/main/resources/org/openrs2/archive/V1__init.sql

@ -563,11 +563,19 @@ public class CacheImporter @Inject constructor(
connection.prepareStatement(
"""
INSERT INTO indexes (container_id)
VALUES (?)
INSERT INTO indexes (
container_id, protocol, version, has_names, has_digests, has_lengths, has_uncompressed_checksums
)
VALUES (?, ?, ?, ?, ?, ?, ?)
""".trimIndent()
).use { stmt ->
stmt.setLong(1, containerId)
stmt.setInt(2, index.index.protocol.id)
stmt.setInt(3, index.index.version)
stmt.setBoolean(4, index.index.hasNames)
stmt.setBoolean(5, index.index.hasDigests)
stmt.setBoolean(6, index.index.hasLengths)
stmt.setBoolean(7, index.index.hasUncompressedChecksums)
try {
stmt.execute()

@ -57,7 +57,13 @@ CREATE TABLE groups (
);
CREATE TABLE indexes (
container_id BIGINT PRIMARY KEY NOT NULL REFERENCES containers (id)
container_id BIGINT PRIMARY KEY NOT NULL REFERENCES containers (id),
protocol uint1 NOT NULL,
version INTEGER NOT NULL,
has_names BOOLEAN NOT NULL,
has_digests BOOLEAN NOT NULL,
has_lengths BOOLEAN NOT NULL,
has_uncompressed_checksums BOOLEAN NOT NULL
);
CREATE TABLE index_groups (

Loading…
Cancel
Save