Commit e844ba73f571e5d112f9c7a894e4b7ed2b06a234

Authored by xp.Huang
2 parents aa2f3c97 939a9acf

Merge branch '20230201' into 'master'

feat(Thingskit function): 数据库初始化

See merge request huang/thingsboard3.3.2!154

Too many changes to show.

To preserve performance only 3 of 8 files are displayed.

  1 +
  2 +CREATE KEYSPACE IF NOT EXISTS thingsboard
  3 +WITH replication = {
  4 + 'class' : 'SimpleStrategy',
  5 + 'replication_factor' : 1
  6 +};
  7 +
  8 +CREATE TABLE IF NOT EXISTS thingsboard.ts_kv_cf (
  9 + entity_type text, // (DEVICE, CUSTOMER, TENANT)
  10 + entity_id timeuuid,
  11 + key text,
  12 + partition bigint,
  13 + ts bigint,
  14 + bool_v boolean,
  15 + str_v text,
  16 + long_v bigint,
  17 + dbl_v double,
  18 + json_v text,
  19 + PRIMARY KEY (( entity_type, entity_id, key, partition ), ts)
  20 +);
  21 +
  22 +CREATE TABLE IF NOT EXISTS thingsboard.ts_kv_partitions_cf (
  23 + entity_type text, // (DEVICE, CUSTOMER, TENANT)
  24 + entity_id timeuuid,
  25 + key text,
  26 + partition bigint,
  27 + PRIMARY KEY (( entity_type, entity_id, key ), partition)
  28 +) WITH CLUSTERING ORDER BY ( partition ASC )
  29 + AND compaction = { 'class' : 'LeveledCompactionStrategy' };
... ...
  1 +--
  2 +-- Copyright © 2016-2022 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 +CREATE KEYSPACE IF NOT EXISTS thingsboard
  18 +WITH replication = {
  19 + 'class' : 'SimpleStrategy',
  20 + 'replication_factor' : 1
  21 +};
  22 +
  23 +CREATE TABLE IF NOT EXISTS thingsboard.ts_kv_latest_cf (
  24 + entity_type text, // (DEVICE, CUSTOMER, TENANT)
  25 + entity_id timeuuid,
  26 + key text,
  27 + ts bigint,
  28 + bool_v boolean,
  29 + str_v text,
  30 + long_v bigint,
  31 + dbl_v double,
  32 + json_v text,
  33 + PRIMARY KEY (( entity_type, entity_id ), key)
  34 +) WITH compaction = { 'class' : 'LeveledCompactionStrategy' };
... ...
  1 +--
  2 +-- Copyright © 2016-2022 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 +CREATE KEYSPACE IF NOT EXISTS thingsboard
  18 +WITH replication = {
  19 + 'class' : 'SimpleStrategy',
  20 + 'replication_factor' : 1
  21 +};
  22 +
  23 +CREATE TABLE IF NOT EXISTS thingsboard.ts_kv_cf (
  24 + entity_type text, // (DEVICE, CUSTOMER, TENANT)
  25 + entity_id timeuuid,
  26 + key text,
  27 + partition bigint,
  28 + ts bigint,
  29 + bool_v boolean,
  30 + str_v text,
  31 + long_v bigint,
  32 + dbl_v double,
  33 + json_v text,
  34 + PRIMARY KEY (( entity_type, entity_id, key, partition ), ts)
  35 +);
  36 +
  37 +CREATE TABLE IF NOT EXISTS thingsboard.ts_kv_partitions_cf (
  38 + entity_type text, // (DEVICE, CUSTOMER, TENANT)
  39 + entity_id timeuuid,
  40 + key text,
  41 + partition bigint,
  42 + PRIMARY KEY (( entity_type, entity_id, key ), partition)
  43 +) WITH CLUSTERING ORDER BY ( partition ASC )
  44 + AND compaction = { 'class' : 'LeveledCompactionStrategy' };
... ...