Skip to content

Commit 0e35447

Browse files
committed
db: Add stubs for Upgrade410to420, schema-410to420.sql and schema-410to420-cleanup.sql
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent 44c8a33 commit 0e35447

3 files changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package com.cloud.upgrade.dao;
19+
20+
import com.cloud.utils.exception.CloudRuntimeException;
21+
import com.cloud.utils.script.Script;
22+
23+
import java.io.File;
24+
import java.sql.Connection;
25+
import java.sql.PreparedStatement;
26+
import java.sql.ResultSet;
27+
import java.sql.SQLException;
28+
import java.util.UUID;
29+
30+
import org.apache.log4j.Logger;
31+
32+
public class Upgrade410to420 implements DbUpgrade {
33+
final static Logger s_logger = Logger.getLogger(Upgrade410to420.class);
34+
35+
@Override
36+
public String[] getUpgradableVersionRange() {
37+
return new String[] { "4.1.0", "4.2.0" };
38+
}
39+
40+
@Override
41+
public String getUpgradedVersion() {
42+
return "4.2.0";
43+
}
44+
45+
@Override
46+
public boolean supportsRollingUpgrade() {
47+
return false;
48+
}
49+
50+
@Override
51+
public File[] getPrepareScripts() {
52+
String script = Script.findScript("", "db/schema-410to420.sql");
53+
if (script == null) {
54+
throw new CloudRuntimeException("Unable to find db/schema-410to420.sql");
55+
}
56+
57+
return new File[] { new File(script) };
58+
}
59+
60+
@Override
61+
public void performDataMigration(Connection conn) {
62+
}
63+
64+
@Override
65+
public File[] getCleanupScripts() {
66+
String script = Script.findScript("", "db/schema-410to420-cleanup.sql");
67+
if (script == null) {
68+
throw new CloudRuntimeException("Unable to find db/schema-410to420-cleanup.sql");
69+
}
70+
71+
return new File[] { new File(script) };
72+
}
73+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Licensed to the Apache Software Foundation (ASF) under one
2+
-- or more contributor license agreements. See the NOTICE file
3+
-- distributed with this work for additional information
4+
-- regarding copyright ownership. The ASF licenses this file
5+
-- to you under the Apache License, Version 2.0 (the
6+
-- "License"); you may not use this file except in compliance
7+
-- with the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing,
12+
-- software distributed under the License is distributed on an
13+
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
-- KIND, either express or implied. See the License for the
15+
-- specific language governing permissions and limitations
16+
-- under the License.
17+
18+
--;
19+
-- Schema cleanup from 4.1.0 to 4.2.0;
20+
--;
21+

setup/db/db/schema-410to420.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
-- Licensed to the Apache Software Foundation (ASF) under one
2+
-- or more contributor license agreements. See the NOTICE file
3+
-- distributed with this work for additional information
4+
-- regarding copyright ownership. The ASF licenses this file
5+
-- to you under the Apache License, Version 2.0 (the
6+
-- "License"); you may not use this file except in compliance
7+
-- with the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing,
12+
-- software distributed under the License is distributed on an
13+
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
-- KIND, either express or implied. See the License for the
15+
-- specific language governing permissions and limitations
16+
-- under the License.
17+
18+
--;
19+
-- Schema upgrade from 4.1.0 to 4.2.0;
20+
--;
21+

0 commit comments

Comments
 (0)