HIRS/package/scripts/common/upgrade_schema_1.1.0.sql
chubtub b140ab46e9 Added scripts to upgrade hirs_db schema according to package upgrade. At the time of writing
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.
2019-09-11 12:34:23 -04:00

17 lines
497 B
SQL

#commands here if there are schema changes in 1.1.0
DROP PROCEDURE IF EXISTS upgrade_schema_to_1_1_0;
DELIMITER '//'
CREATE PROCEDURE upgrade_schema_to_1_1_0()
BEGIN
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='Certificate' AND COLUMN_NAME='componentFailures')) THEN
ALTER TABLE Certificate ADD componentFailures varchar(255) DEFAULT NULL;
END IF;
END//
DELIMITER ';'
CALL upgrade_schema_to_1_1_0;
DROP PROCEDURE upgrade_schema_to_1_1_0;