Showing
1 changed file
with
18 additions
and
8 deletions
... | ... | @@ -76,12 +76,23 @@ UPDATE "public"."sys_user" SET "username" = 'sysadmin', "password" = '$2a$10$fae |
76 | 76 | -- **************************** |
77 | 77 | CREATE EXTENSION IF NOT EXISTS "uuid-ossp" CASCADE; |
78 | 78 | |
79 | - | |
80 | -INSERT INTO rule_node (created_time, rule_chain_id,debug_mode,id, additional_info, configuration, type, name, search_text) | |
81 | -SELECT created_time,rule_chain_id,debug_mode,uuid_generate_v4() as id, '{"description":"","layoutX":824,"layoutY":549}' as additional_info, '{"useServerTs":true}' as configuration, 'org.thingsboard.rule.engine.yunteng.event.TkMsgEventNode' as type, 'save events' as name, 'save events' as search_text from rule_node | |
79 | +------------------------------------------------------------------------------------ | |
80 | +---------【规则引擎】--------------------------------------------------------------- | |
81 | +------------------------------------------------------------------------------------ | |
82 | +-- select * from rule_chain where id ='377f3190-67a9-11ed-9e12-e5edad4f7148'::uuid; | |
83 | +-- select * from rule_node where rule_chain_id ='377f3190-67a9-11ed-9e12-e5edad4f7148'::uuid ; --and (search_text like '%save%') | |
84 | +-- select * from relation where from_type ='RULE_CHAIN' and from_id = '377f3190-67a9-11ed-9e12-e5edad4f7148'::uuid; | |
85 | +-- select * from relation where from_type ='RULE_NODE' and relation_type like '%Post%' and to_id in('64c21d80-b406-11ed-a8fc-35db155494e7'::uuid,'64c68a50-b406-11ed-a8fc-35db155494e7'::uuid); | |
86 | +INSERT INTO rule_node (created_time, rule_chain_id,debug_mode,id, additional_info, configuration, type, name, search_text) | |
87 | +SELECT created_time,rule_chain_id,debug_mode,uuid_generate_v4() as id, '{"description":"","layoutX":824,"layoutY":549}' as additional_info, '{"useServerTs":true}' as configuration, 'org.thingsboard.rule.engine.yunteng.event.TkMsgEventNode' as type, 'save events' as name, 'save events' as search_text from rule_node | |
82 | 88 | WHERE name like '%Save Client Attributes%' and rule_chain_id not in (select id from rule_chain where type = 'EDGE') and rule_chain_id not in (select rule_chain_id from rule_node where type = 'org.thingsboard.rule.engine.yunteng.event.TkMsgEventNode'); |
83 | 89 | |
84 | -INSERT INTO relation (from_id, from_type, to_type, relation_type_group,to_id, relation_type) | |
90 | +INSERT INTO relation (from_id,to_id, from_type, to_type, relation_type_group, relation_type) | |
91 | +SELECT n.rule_chain_id as from_id,n.id as to_id, 'RULE_CHAIN' as from_type, 'RULE_NODE' as to_type, 'RULE_CHAIN' as relation_type_group, 'Contains' as relation_type from rule_node n | |
92 | +left join relation r on r.to_id = n.id and r.from_type = 'RULE_CHAIN' and r.from_id = n.rule_chain_id | |
93 | +WHERE name ='save events' and r.to_id is null; | |
94 | + | |
95 | +INSERT INTO relation (from_id, from_type, to_type, relation_type_group,to_id, relation_type) | |
85 | 96 | SELECT r.from_id, r.from_type, r.to_type, r.relation_type_group, t.id as to_id,'Post event' as relation_type from relation r left join rule_node f on r.from_id = f.id left join rule_node t on f.rule_chain_id=t.rule_chain_id and t.name ='save events' |
86 | 97 | WHERE relation_type like '%Post attributes%' and from_id not in(select from_id from relation where relation_type like '%Post event%') and from_id not in(select n.id from rule_node n left join rule_chain c on n.rule_chain_id = c.id where c.type = 'EDGE' and n.name like '%Message Type Switch%'); |
87 | 98 | |
... | ... | @@ -90,8 +101,7 @@ WHERE relation_type like '%Post attributes%' and from_id not in(select from_id f |
90 | 101 | |
91 | 102 | |
92 | 103 | |
104 | +------------------------------------------------------------------------------------ | |
105 | +---------【设备配置】--------------------------------------------------------------- | |
106 | +------------------------------------------------------------------------------------ | |
93 | 107 | |
94 | - | |
95 | ---select * from rule_chain where id ='64b7bd40-b406-11ed-a8fc-35db155494e7'::uuid; | |
96 | ---select * from rule_node where rule_chain_id ='64b7bd40-b406-11ed-a8fc-35db155494e7'::uuid and (search_text like '%save%' or id ='64c2b9c0-b406-11ed-a8fc-35db155494e7'::uuid); | |
97 | ---select * from relation where relation_type like '%Post%' and to_id in('64c21d80-b406-11ed-a8fc-35db155494e7'::uuid,'64c68a50-b406-11ed-a8fc-35db155494e7'::uuid); | ... | ... |