Commit f879c48deb4f46701a7fe41def139f746a57c5ae
1 parent
abfddf44
feat: 在application的data目录下加入cassandra的脚本
Showing
3 changed files
with
87 additions
and
0 deletions
1 | +-- | |
2 | +-- Copyright © 2016-2024 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 | +}; | ... | ... |
1 | +-- | |
2 | +-- Copyright © 2016-2024 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 TABLE IF NOT EXISTS thingsboard.ts_kv_latest_cf ( | |
18 | + entity_type text, -- (DEVICE, CUSTOMER, TENANT) | |
19 | + entity_id timeuuid, | |
20 | + key text, | |
21 | + ts bigint, | |
22 | + bool_v boolean, | |
23 | + str_v text, | |
24 | + long_v bigint, | |
25 | + dbl_v double, | |
26 | + json_v text, | |
27 | + PRIMARY KEY (( entity_type, entity_id ), key) | |
28 | +) WITH compaction = { 'class' : 'LeveledCompactionStrategy' }; | ... | ... |
1 | +-- | |
2 | +-- Copyright © 2016-2024 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 TABLE IF NOT EXISTS thingsboard.ts_kv_cf ( | |
18 | + entity_type text, -- (DEVICE, CUSTOMER, TENANT) | |
19 | + entity_id timeuuid, | |
20 | + key text, | |
21 | + partition bigint, | |
22 | + ts bigint, | |
23 | + bool_v boolean, | |
24 | + str_v text, | |
25 | + long_v bigint, | |
26 | + dbl_v double, | |
27 | + json_v text, | |
28 | + PRIMARY KEY (( entity_type, entity_id, key, partition ), ts) | |
29 | +); | |
30 | + | |
31 | +CREATE TABLE IF NOT EXISTS thingsboard.ts_kv_partitions_cf ( | |
32 | + entity_type text, -- (DEVICE, CUSTOMER, TENANT) | |
33 | + entity_id timeuuid, | |
34 | + key text, | |
35 | + partition bigint, | |
36 | + PRIMARY KEY (( entity_type, entity_id, key ), partition) | |
37 | +) WITH CLUSTERING ORDER BY ( partition ASC ) | |
38 | + AND compaction = { 'class' : 'LeveledCompactionStrategy' }; | ... | ... |