Commit 7c381995fb1cf6c1d922deb657a43941098d5c52
1 parent
791f4a3a
Fix for entity view keys sql field
Showing
5 changed files
with
36 additions
and
5 deletions
1 | +-- | |
2 | +-- Copyright © 2016-2018 The Thingsboard Authors | |
3 | +-- | |
4 | +-- Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | +-- you may not use this file except in compliance with the License. | |
6 | +-- You may obtain a copy of the License at | |
7 | +-- | |
8 | +-- http://www.apache.org/licenses/LICENSE-2.0 | |
9 | +-- | |
10 | +-- Unless required by applicable law or agreed to in writing, software | |
11 | +-- distributed under the License is distributed on an "AS IS" BASIS, | |
12 | +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | +-- See the License for the specific language governing permissions and | |
14 | +-- limitations under the License. | |
15 | +-- | |
16 | + | |
17 | +ALTER TABLE entity_view ALTER COLUMN keys SET DATA TYPE varchar(10000000); | |
\ No newline at end of file | ... | ... |
... | ... | @@ -101,11 +101,17 @@ public class ThingsboardInstallService { |
101 | 101 | log.info("Upgrading ThingsBoard from version 2.1.1 to 2.1.2 ..."); |
102 | 102 | |
103 | 103 | databaseUpgradeService.upgradeDatabase("2.1.1"); |
104 | + | |
104 | 105 | case "2.1.3": |
105 | 106 | log.info("Upgrading ThingsBoard from version 2.1.3 to 2.2.0 ..."); |
106 | 107 | |
107 | 108 | databaseUpgradeService.upgradeDatabase("2.1.3"); |
108 | 109 | |
110 | + case "2.2.0": | |
111 | + log.info("Upgrading ThingsBoard from version 2.2.0 to 2.2.1 ..."); | |
112 | + | |
113 | + databaseUpgradeService.upgradeDatabase("2.2.0"); | |
114 | + | |
109 | 115 | log.info("Updating system data..."); |
110 | 116 | |
111 | 117 | systemDataLoaderService.deleteSystemWidgetBundle("charts"); | ... | ... |
... | ... | @@ -157,6 +157,14 @@ public class SqlDatabaseUpgradeService implements DatabaseUpgradeService { |
157 | 157 | log.info("Schema updated."); |
158 | 158 | } |
159 | 159 | break; |
160 | + case "2.2.0": | |
161 | + try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword)) { | |
162 | + log.info("Updating schema ..."); | |
163 | + schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "2.2.1", SCHEMA_UPDATE_SQL); | |
164 | + loadSql(schemaUpdateFile, conn); | |
165 | + log.info("Schema updated."); | |
166 | + } | |
167 | + break; | |
160 | 168 | default: |
161 | 169 | throw new RuntimeException("Unable to upgrade SQL database, unsupported fromVersion: " + fromVersion); |
162 | 170 | } | ... | ... |
... | ... | @@ -60,10 +60,6 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> { |
60 | 60 | @Column(name = ID_PROPERTY) |
61 | 61 | private UUID id; |
62 | 62 | |
63 | - @Enumerated(EnumType.STRING) | |
64 | - @Column(name = ENTITY_TYPE_PROPERTY) | |
65 | - private EntityType entityType; | |
66 | - | |
67 | 63 | @PartitionKey(value = 1) |
68 | 64 | @Column(name = ModelConstants.ENTITY_VIEW_TENANT_ID_PROPERTY) |
69 | 65 | private UUID tenantId; |
... | ... | @@ -76,6 +72,10 @@ public class EntityViewEntity implements SearchTextEntity<EntityView> { |
76 | 72 | @Column(name = DEVICE_TYPE_PROPERTY) |
77 | 73 | private String type; |
78 | 74 | |
75 | + @Enumerated(EnumType.STRING) | |
76 | + @Column(name = ENTITY_TYPE_PROPERTY) | |
77 | + private EntityType entityType; | |
78 | + | |
79 | 79 | @Column(name = ModelConstants.ENTITY_VIEW_ENTITY_ID_PROPERTY) |
80 | 80 | private UUID entityId; |
81 | 81 | ... | ... |
... | ... | @@ -236,7 +236,7 @@ CREATE TABLE IF NOT EXISTS entity_view ( |
236 | 236 | customer_id varchar(31), |
237 | 237 | type varchar(255), |
238 | 238 | name varchar(255), |
239 | - keys varchar(255), | |
239 | + keys varchar(10000000), | |
240 | 240 | start_ts bigint, |
241 | 241 | end_ts bigint, |
242 | 242 | search_text varchar(255), | ... | ... |