docs/migrations/server/mysql/0003_add_sha256_tuf_files.u...

6 lines
298 B
SQL

ALTER TABLE `tuf_files` ADD COLUMN `sha256` CHAR(64) DEFAULT NULL, ADD INDEX `sha256` (`sha256`);
-- SHA2 function takes the column name or a string as the first parameter, and the
-- hash size as the second argument. It returns a hex string.
UPDATE `tuf_files` SET `sha256` = SHA2(`data`, 256);