schema: add upgrade path from 4.3.0 to 4.3.1 Signed-off-by: Rohit Yadav <rohit.ya...@shapeblue.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/15549f3b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/15549f3b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/15549f3b Branch: refs/heads/hotfix/4.3-CLOUDSTACK-6756 Commit: 15549f3b63d3ad182d43bb924d49dc15fe1300d2 Parents: 79edd93 Author: Rohit Yadav <rohit.ya...@shapeblue.com> Authored: Tue Sep 2 18:46:46 2014 +0200 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Tue Sep 2 18:46:46 2014 +0200 ---------------------------------------------------------------------- .../com/cloud/upgrade/dao/Upgrade430to431.java | 7 ++++- setup/db/db/schema-430to431.sql | 29 ++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15549f3b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java index 7f23cad..3e7cb46 100644 --- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java +++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade430to431.java @@ -58,7 +58,12 @@ public class Upgrade430to431 implements DbUpgrade { @Override public File[] getPrepareScripts() { - return null; + String script = Script.findScript("", "db/schema-430to431.sql"); + if (script == null) { + throw new CloudRuntimeException("Unable to find db/schema-430to431.sql"); + } + + return new File[] {new File(script)}; } @Override http://git-wip-us.apache.org/repos/asf/cloudstack/blob/15549f3b/setup/db/db/schema-430to431.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-430to431.sql b/setup/db/db/schema-430to431.sql new file mode 100644 index 0000000..dfafbb8 --- /dev/null +++ b/setup/db/db/schema-430to431.sql @@ -0,0 +1,29 @@ +-- Licensed to the Apache Software Foundation (ASF) under one +-- or more contributor license agreements. See the NOTICE file +-- distributed with this work for additional information +-- regarding copyright ownership. The ASF licenses this file +-- to you under the Apache License, Version 2.0 (the +-- "License"); you may not use this file except in compliance +-- with the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, +-- software distributed under the License is distributed on an +-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +-- KIND, either express or implied. See the License for the +-- specific language governing permissions and limitations +-- under the License. + +--; +-- Schema upgrade from 4.3.0 to 4.3.1; +--; + +alter table user_ip_address add column removed datetime DEFAULT NULL COMMENT 'date removed'; +alter table user_ip_address add column created datetime NULL COMMENT 'date created'; + +alter table vlan add column removed datetime DEFAULT NULL COMMENT 'date removed'; +alter table vlan add column created datetime NULL COMMENT 'date created'; + +alter table user_ip_address drop key public_ip_address; +alter table user_ip_address add UNIQUE KEY public_ip_address (public_ip_address,source_network_id, removed);