@@ -12,7 +12,7 @@ DELETE FROM entities WHERE id = 50;
...
@@ -12,7 +12,7 @@ DELETE FROM entities WHERE id = 50;
CREATE TABLE IF NOT EXISTS file_hashes (
CREATE TABLE IF NOT EXISTS file_hashes (
file_id INT UNSIGNED,
file_id INT UNSIGNED,
digest VARBINARY(255) NOT NULL,
digest VARBINARY(255) NOT NULL,
algorithm VARBINARY(255) NOT NULL DEFAULT "SHA-512",
algorithm VARBINARY(255) NOT NULL,
checked_timestamp BIGINT NOT NULL DEFAULT 0,
checked_timestamp BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY (file_id, algorithm),
PRIMARY KEY (file_id, algorithm),
FOREIGN KEY (file_id) REFERENCES files (file_id)
FOREIGN KEY (file_id) REFERENCES files (file_id)
...
@@ -30,8 +30,8 @@ CREATE TABLE IF NOT EXISTS archive_file_hashes (
...
@@ -30,8 +30,8 @@ CREATE TABLE IF NOT EXISTS archive_file_hashes (
);
);
-- Move existing hash data to new tables...
-- Move existing hash data to new tables...
INSERT INTO file_hashes (file_id, digest, checked_timestamp) SELECT file_id, hash, checked_timestamp FROM files WHERE hash IS NOT NULL;
INSERT INTO file_hashes (file_id, digest, algorithm, checked_timestamp) SELECT file_id, hash, "SHA-512", checked_timestamp FROM files WHERE hash IS NOT NULL;
INSERT INTO archive_file_hashes (file_id, _iversion, digest, checked_timestamp) SELECT file_id, _iversion, hash, checked_timestamp FROM archive_files WHERE hash IS NOT NULL;
INSERT INTO archive_file_hashes (file_id, _iversion, digest, algorithm, checked_timestamp) SELECT file_id, _iversion, hash, "SHA-512", checked_timestamp FROM archive_files WHERE hash IS NOT NULL;
-- and remove hash colums from the files and archive_files tables.
-- and remove hash colums from the files and archive_files tables.
ALTER TABLE files DROP COLUMN hash;
ALTER TABLE files DROP COLUMN hash;
...
@@ -40,19 +40,21 @@ ALTER TABLE archive_files DROP COLUMN hash;
...
@@ -40,19 +40,21 @@ ALTER TABLE archive_files DROP COLUMN hash;