mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-24 07:06:46 +00:00
Created sql script to add columns to backend. Call script from spec file.
This commit is contained in:
parent
5256c57f13
commit
ad3aa1a6c6
@ -192,12 +192,22 @@ if [ $1 -gt 1 ]; then
|
|||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
elif [ %{version} == "1.1.0" ]; then
|
elif [ %{version} == "1.1.0" ]; then
|
||||||
if (mysql -u root hirs_db < /opt/hirs/scripts/common/upgrade_schema_1.0.4.sql && mysql -u root hirs_db < /opt/hirs/scripts/common/upgrade_schema_1.1.0.sql); then
|
if (mysql -u root hirs_db < /opt/hirs/scripts/common/upgrade_schema_1.0.4.sql && \
|
||||||
|
mysql -u root hirs_db < /opt/hirs/scripts/common/upgrade_schema_1.1.0.sql); then
|
||||||
echo "Upgrade to version 1.1.0"
|
echo "Upgrade to version 1.1.0"
|
||||||
else
|
else
|
||||||
echo "Error upgrading HIRS database schema to 1.1.0!"
|
echo "Error upgrading HIRS database schema to 1.1.0!"
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
elif [ %{version} == "1.1.1" ]; then
|
||||||
|
if (mysql -u root hirs_db < /opt/hirs/scripts/common/upgrade_schema_1.0.4.sql && \
|
||||||
|
mysql -u root hirs_db < /opt/hirs/scripts/common/upgrade_schema_1.1.0.sql && \
|
||||||
|
mysql -u root hirs_db < /opt/hirs/scripts/common/upgrade_schema_1.1.1.sql); then
|
||||||
|
echo "Upgrade to version 1.1.1"
|
||||||
|
else
|
||||||
|
echo "Error upgrading HIRS database schema to 1.1.1!"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
23
package/scripts/common/upgrade_schema_1.1.1.sql
Normal file
23
package/scripts/common/upgrade_schema_1.1.1.sql
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
DROP PROCEDURE IF EXISTS upgrade_schema_to_1_1_1;
|
||||||
|
DELIMITER '//'
|
||||||
|
|
||||||
|
CREATE PROCEDURE upgrade_schema_to_1_1_1()
|
||||||
|
BEGIN
|
||||||
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='Certificate' AND COLUMN_NAME='tcgCredentialMajorVersion')) THEN
|
||||||
|
ALTER TABLE Certificate ADD tcgCredentialMajorVersion int(11) DEFAULT NULL;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='Certificate' AND COLUMN_NAME='tcgCredentialMinorVersion')) THEN
|
||||||
|
ALTER TABLE Certificate ADD tcgCredentialMinorVersion int(11) DEFAULT NULL;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF(NOT EXISTS(SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='hirs_db' AND TABLE_NAME='Certificate' AND COLUMN_NAME='tcgCredentialRevisionLevel')) THEN
|
||||||
|
ALTER TABLE Certificate ADD tcgCredentialRevisionLevel int(11) DEFAULT NULL;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
END//
|
||||||
|
DELIMITER ';'
|
||||||
|
|
||||||
|
CALL upgrade_schema_to_1_1_1;
|
||||||
|
DROP PROCEDURE upgrade_schema_to_1_1_1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user