Commit 7de309e217087a866c1ed0d03bb43e88bad56338
Committed by
Andrew Shvayka
1 parent
96147bff
Created HsqlEntityDatabaseSchemaService, improvement TimescaleTsDatabaseUpgradeS…
…ervice and TimescaleInsertTsRepository
Showing
4 changed files
with
39 additions
and
4 deletions
1 | +/** | |
2 | + * Copyright © 2016-2020 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 | +package org.thingsboard.server.service.install; | |
17 | + | |
18 | +import org.springframework.context.annotation.Profile; | |
19 | +import org.springframework.stereotype.Service; | |
20 | +import org.thingsboard.server.dao.util.HsqlDao; | |
21 | +import org.thingsboard.server.dao.util.SqlDao; | |
22 | + | |
23 | +@Service | |
24 | +@HsqlDao | |
25 | +@SqlDao | |
26 | +@Profile("install") | |
27 | +public class HsqlEntityDatabaseSchemaService extends SqlAbstractDatabaseSchemaService | |
28 | + implements EntityDatabaseSchemaService { | |
29 | + protected HsqlEntityDatabaseSchemaService() { | |
30 | + super("schema-entities-hsql.sql", "schema-entities-idx.sql"); | |
31 | + } | |
32 | +} | |
33 | + | ... | ... |
application/src/main/java/org/thingsboard/server/service/install/PsqlEntityDatabaseSchemaService.java
renamed from
application/src/main/java/org/thingsboard/server/service/install/SqlEntityDatabaseSchemaService.java
... | ... | @@ -17,14 +17,16 @@ package org.thingsboard.server.service.install; |
17 | 17 | |
18 | 18 | import org.springframework.context.annotation.Profile; |
19 | 19 | import org.springframework.stereotype.Service; |
20 | +import org.thingsboard.server.dao.util.PsqlDao; | |
20 | 21 | import org.thingsboard.server.dao.util.SqlDao; |
21 | 22 | |
22 | 23 | @Service |
23 | 24 | @SqlDao |
25 | +@PsqlDao | |
24 | 26 | @Profile("install") |
25 | -public class SqlEntityDatabaseSchemaService extends SqlAbstractDatabaseSchemaService | |
27 | +public class PsqlEntityDatabaseSchemaService extends SqlAbstractDatabaseSchemaService | |
26 | 28 | implements EntityDatabaseSchemaService { |
27 | - public SqlEntityDatabaseSchemaService() { | |
29 | + public PsqlEntityDatabaseSchemaService() { | |
28 | 30 | super("schema-entities.sql", "schema-entities-idx.sql"); |
29 | 31 | } |
30 | 32 | } | ... | ... |
... | ... | @@ -104,7 +104,7 @@ public class TimescaleTsDatabaseUpgradeService extends AbstractSqlTsDatabaseUpgr |
104 | 104 | executeDropStatement(conn, DROP_FUNCTION_INSERT_INTO_TENANT_TS_KV); |
105 | 105 | executeDropStatement(conn, DROP_FUNCTION_INSERT_INTO_TS_KV_LATEST); |
106 | 106 | |
107 | - executeQuery(conn, "ALTER TABLE ts_kv ADD COLUMN json_v json;"); | |
107 | + executeQuery(conn, "ALTER TABLE tenant_ts_kv ADD COLUMN json_v json;"); | |
108 | 108 | executeQuery(conn, "ALTER TABLE ts_kv_latest ADD COLUMN json_v json;"); |
109 | 109 | |
110 | 110 | log.info("schema timeseries updated!"); | ... | ... |
dao/src/main/java/org/thingsboard/server/dao/sqlts/insert/timescale/TimescaleInsertTsRepository.java
... | ... | @@ -53,7 +53,7 @@ public class TimescaleInsertTsRepository extends AbstractInsertRepository implem |
53 | 53 | |
54 | 54 | if (tsKvEntity.getBooleanValue() != null) { |
55 | 55 | ps.setBoolean(5, tsKvEntity.getBooleanValue()); |
56 | - ps.setBoolean(9, tsKvEntity.getBooleanValue()); | |
56 | + ps.setBoolean(10, tsKvEntity.getBooleanValue()); | |
57 | 57 | } else { |
58 | 58 | ps.setNull(5, Types.BOOLEAN); |
59 | 59 | ps.setNull(10, Types.BOOLEAN); | ... | ... |