mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-22 06:17:56 +00:00
b140ab46e9
there are schema changes when upgrading from 1.0.3 to 1.0.4 but not when upgrading to 1.1.0. These scripts are called when 'yum upgrade HIRS_AttestationCA' is invoked. Fixed script file path Fixed MySQL syntax error These changes now differentiate between upgrade versions and add respective columns, and also account for upgrades from 1.0.3 directly to 1.1.0.
31 lines
1.3 KiB
SQL
31 lines
1.3 KiB
SQL
DROP PROCEDURE IF EXISTS upgrade_schema_to_1_0_4;
|
|
DELIMITER '//'
|
|
|
|
CREATE PROCEDURE upgrade_schema_to_1_0_4()
|
|
BEGIN
|
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='Certificate' AND COLUMN_NAME='isDeltaChain')) THEN
|
|
ALTER TABLE Certificate ADD isDeltaChain bit(1) DEFAULT NULL;
|
|
END IF;
|
|
|
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='Certificate' AND COLUMN_NAME='platformBase')) THEN
|
|
ALTER TABLE Certificate ADD platformBase bit(1) DEFAULT NULL;
|
|
END IF;
|
|
|
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='Certificate' AND COLUMN_NAME='platformChainType')) THEN
|
|
ALTER TABLE Certificate ADD platformChainType varchar(255) DEFAULT NULL;
|
|
END IF;
|
|
|
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='SupplyChainValidationSummary' AND COLUMN_NAME='message')) THEN
|
|
ALTER TABLE SupplyChainValidationSummary ADD message longtext;
|
|
END IF;
|
|
|
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='TPMReport' AND COLUMN_NAME='rawQuote')) THEN
|
|
ALTER TABLE TPMReport ADD rawQuote blob;
|
|
END IF;
|
|
END//
|
|
DELIMITER ';'
|
|
|
|
CALL upgrade_schema_to_1_0_4;
|
|
DROP PROCEDURE upgrade_schema_to_1_0_4;
|
|
|