Commit 8180fca7 authored by Leigh B Stoller's avatar Leigh B Stoller

Add "hash" to the images table to store a sha1 of the file.

parent 1c4ec177
......@@ -1746,6 +1746,7 @@ CREATE TABLE `images` (
`auth_uuid` varchar(64) default NULL,
`auth_key` varchar(512) default NULL,
`decryption_key` varchar(256) default NULL,
`hash` varchar(64) default NULL,
PRIMARY KEY (`imageid`),
UNIQUE KEY `pid` (`pid`,`imagename`),
KEY `gid` (`gid`),
......
......@@ -1052,7 +1052,7 @@ REPLACE INTO table_regex VALUES ('images','mbr_version','text','redirect','defau
REPLACE INTO table_regex VALUES ('images','max_concurrent','text','redirect','default:int',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','reboot_waittime','text','redirect','default:int',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','format','text','regex','^[-\\w]+$',1,8,NULL);
REPLACE INTO table_regex VALUES ('images','hash','text','regex','^[\\w]+$',16,64,NULL);
REPLACE INTO table_regex VALUES ('node_types','new_type','text','redirect','default:tinytext',0,0,NULL);
REPLACE INTO table_regex VALUES ('node_types','node_type','text','regex','^[-\\w]+$',1,30,NULL);
REPLACE INTO table_regex VALUES ('node_types','class','text','regex','^[\\w]+$',1,30,NULL);
......
#
# Add hash to images table.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (! DBSlotExists("images", "hash")) {
DBQueryFatal("alter table images add ".
" `hash` varchar(64) default NULL");
}
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('images','hash','text','regex','^[\\\\w]+\$',16,64,NULL)");
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment