diff --git a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java index 867fc02d999..99250442f7c 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/DatabaseUpgradeChecker.java @@ -29,6 +29,7 @@ import java.util.Date; import javax.inject.Inject; +import com.cloud.upgrade.dao.Upgrade41510to41520; import org.apache.cloudstack.utils.CloudStackVersion; import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; @@ -71,7 +72,7 @@ import com.cloud.upgrade.dao.Upgrade41300to41310; import com.cloud.upgrade.dao.Upgrade41310to41400; import com.cloud.upgrade.dao.Upgrade41400to41500; import com.cloud.upgrade.dao.Upgrade41500to41510; -import com.cloud.upgrade.dao.Upgrade41510to41600; +import com.cloud.upgrade.dao.Upgrade41520to41600; import com.cloud.upgrade.dao.Upgrade420to421; import com.cloud.upgrade.dao.Upgrade421to430; import com.cloud.upgrade.dao.Upgrade430to440; @@ -198,8 +199,8 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { .next("4.14.0.0", new Upgrade41400to41500()) .next("4.14.1.0", new Upgrade41400to41500()) .next("4.15.0.0", new Upgrade41500to41510()) - .next("4.15.1.0", new Upgrade41510to41600()) - .next("4.15.2.0", new Upgrade41510to41600()) + .next("4.15.1.0", new Upgrade41510to41520()) + .next("4.15.2.0", new Upgrade41520to41600()) .build(); } diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41520.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41520.java new file mode 100644 index 00000000000..8416651ca87 --- /dev/null +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41520.java @@ -0,0 +1,66 @@ +// 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. +package com.cloud.upgrade.dao; + +import com.cloud.utils.exception.CloudRuntimeException; + +import java.io.InputStream; +import java.sql.Connection; + +public class Upgrade41510to41520 implements DbUpgrade { + + @Override + public String[] getUpgradableVersionRange() { + return new String[]{"4.15.1.0", "4.15.2.0"}; + } + + @Override + public String getUpgradedVersion() { + return "4.15.2.0"; + } + + @Override + public boolean supportsRollingUpgrade() { + return false; + } + + @Override + public InputStream[] getPrepareScripts() { + final String scriptFile = "META-INF/db/schema-41510to41520.sql"; + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[] {script}; + } + + @Override + public void performDataMigration(Connection conn) { + } + + @Override + public InputStream[] getCleanupScripts() { + final String scriptFile = "META-INF/db/schema-41510to41520-cleanup.sql"; + final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); + if (script == null) { + throw new CloudRuntimeException("Unable to find " + scriptFile); + } + + return new InputStream[] {script}; + } +} diff --git a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41600.java b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java similarity index 97% rename from engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41600.java rename to engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java index 358fa574faa..eea3a58ef44 100644 --- a/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41510to41600.java +++ b/engine/schema/src/main/java/com/cloud/upgrade/dao/Upgrade41520to41600.java @@ -32,13 +32,13 @@ import org.apache.log4j.Logger; import com.cloud.hypervisor.Hypervisor; import com.cloud.utils.exception.CloudRuntimeException; -public class Upgrade41510to41600 implements DbUpgrade, DbUpgradeSystemVmTemplate { +public class Upgrade41520to41600 implements DbUpgrade, DbUpgradeSystemVmTemplate { - final static Logger LOG = Logger.getLogger(Upgrade41510to41600.class); + final static Logger LOG = Logger.getLogger(Upgrade41520to41600.class); @Override public String[] getUpgradableVersionRange() { - return new String[] {"4.15.1.0", "4.16.0.0"}; + return new String[] {"4.15.2.0", "4.16.0.0"}; } @Override @@ -53,7 +53,7 @@ public class Upgrade41510to41600 implements DbUpgrade, DbUpgradeSystemVmTemplate @Override public InputStream[] getPrepareScripts() { - final String scriptFile = "META-INF/db/schema-41510to41600.sql"; + final String scriptFile = "META-INF/db/schema-41520to41600.sql"; final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); if (script == null) { throw new CloudRuntimeException("Unable to find " + scriptFile); @@ -237,7 +237,7 @@ public class Upgrade41510to41600 implements DbUpgrade, DbUpgradeSystemVmTemplate @Override public InputStream[] getCleanupScripts() { - final String scriptFile = "META-INF/db/schema-41510to41600-cleanup.sql"; + final String scriptFile = "META-INF/db/schema-41520to41600-cleanup.sql"; final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile); if (script == null) { throw new CloudRuntimeException("Unable to find " + scriptFile); diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41510to41600-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-41510to41520-cleanup.sql similarity index 93% rename from engine/schema/src/main/resources/META-INF/db/schema-41510to41600-cleanup.sql rename to engine/schema/src/main/resources/META-INF/db/schema-41510to41520-cleanup.sql index bbba515cdee..e36ac308d59 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41510to41600-cleanup.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41510to41520-cleanup.sql @@ -16,6 +16,6 @@ -- under the License. --; --- Schema upgrade cleanup from 4.15.1.0 to 4.16.0.0 +-- Schema upgrade cleanup from 4.15.1.0 to 4.15.2.0 --; diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41510to41520.sql b/engine/schema/src/main/resources/META-INF/db/schema-41510to41520.sql new file mode 100644 index 00000000000..d0a08c16f78 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-41510to41520.sql @@ -0,0 +1,21 @@ +-- 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.15.1.0 to 4.15.2.0 +--; + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41520to41600-cleanup.sql b/engine/schema/src/main/resources/META-INF/db/schema-41520to41600-cleanup.sql new file mode 100644 index 00000000000..e69d34fc9e6 --- /dev/null +++ b/engine/schema/src/main/resources/META-INF/db/schema-41520to41600-cleanup.sql @@ -0,0 +1,21 @@ +-- 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 cleanup from 4.15.2.0 to 4.16.0.0 +--; + diff --git a/engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql b/engine/schema/src/main/resources/META-INF/db/schema-41520to41600.sql similarity index 99% rename from engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql rename to engine/schema/src/main/resources/META-INF/db/schema-41520to41600.sql index cc43cc61a03..9a30ed51a17 100644 --- a/engine/schema/src/main/resources/META-INF/db/schema-41510to41600.sql +++ b/engine/schema/src/main/resources/META-INF/db/schema-41520to41600.sql @@ -16,7 +16,7 @@ -- under the License. --; --- Schema upgrade from 4.15.1.0 to 4.16.0.0 +-- Schema upgrade from 4.15.2.0 to 4.16.0.0 --; -- Adding dynamic scalable flag for service offering table