/*UPDATEREVISION*/
INSERT INTO site (`setting`, `value`, `updateddate` ) VALUES ('dbversion', '$Rev: 2751 $', now()) ON DUPLICATE KEY UPDATE `value` = VALUES(`value`), updateddate=now();

/*PATCHHERE*/
CREATE TABLE `spotnabsources` (
		`ID` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
		`username` VARCHAR(64) NOT NULL DEFAULT '',
		`useremail` VARCHAR(128) NOT NULL DEFAULT '',
		`usenetgroup` VARCHAR(64) NOT NULL DEFAULT 'alt.binaries.backup',
		`publickey` VARCHAR(512) NOT NULL DEFAULT '',
		`active` TINYINT(1) NOT NULL DEFAULT '1',
		`description` VARCHAR(255) NULL DEFAULT '',
		`lastupdate` DATETIME DEFAULT NULL,
		PRIMARY KEY  (`ID`)
		) ENGINE=MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci AUTO_INCREMENT=1 ;

-- We must update releases table to track Global Identifier
ALTER TABLE `releases` ADD  `gid` VARCHAR( 32 ) NULL AFTER  `ID` ;
ALTER TABLE `releases` ADD INDEX `ix_releases_gid` (  `gid` );

INSERT INTO `site` (`ID` , `setting` , `value` , `updateddate` )
	VALUES ( NULL ,  'spotnabsitepubkey',  '', NOW( ));
INSERT INTO `site` (`ID` , `setting` , `value` , `updateddate` )
	VALUES ( NULL ,  'spotnabsiteprvkey',  '', NOW( ));
INSERT INTO `site` (`ID` , `setting` , `value` , `updateddate` )
	VALUES ( NULL ,  'spotnabuser',  '', NOW( ));
INSERT INTO `site` (`ID` , `setting` , `value` , `updateddate` )
	VALUES ( NULL ,  'spotnabemail',  '', NOW( ));
INSERT INTO `site` (`ID` , `setting` , `value` , `updateddate` )
	VALUES ( NULL ,  'spotnabgroup',  'alt.binaries.backup', NOW( ));
INSERT INTO `site` (`ID` , `setting` , `value` , `updateddate` )
	VALUES ( NULL ,  'spotnabpost',  '0', NOW( ));

ALTER TABLE `releasecomment` ADD  `sourceID` BIGINT UNSIGNED NOT NULL DEFAULT 0 AFTER  `ID` ;
ALTER TABLE `releasecomment` ADD  `gid` VARCHAR( 32 ) DEFAULT NULL AFTER  `sourceID` ;
ALTER TABLE `releasecomment` ADD  `cid` VARCHAR( 32 ) DEFAULT NULL AFTER `gid` ;
ALTER TABLE `releasecomment` ADD  `username` VARCHAR( 50 ) DEFAULT NULL AFTER `userID` ;
ALTER TABLE `releasecomment` ADD  `isvisible` TINYINT(1) DEFAULT 1 AFTER `text` ;
ALTER TABLE `releasecomment` ADD  `issynced` TINYINT(1) DEFAULT 0 AFTER `isvisible` ;
ALTER TABLE `releasecomment` ADD INDEX `ix_releasecomment_cid` ( `cid` );
ALTER TABLE `releasecomment` ADD INDEX `ix_releasecomment_gid` ( `gid` );
