|
|
|
@ -339,6 +339,19 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
|
|
|
|
try { |
|
|
|
conn.createStatement().execute("CREATE TABLE IF NOT EXISTS rule_node_state (" + |
|
|
|
" id uuid NOT NULL CONSTRAINT rule_node_state_pkey PRIMARY KEY," + |
|
|
|
" created_time bigint NOT NULL," + |
|
|
|
" rule_node_id uuid NOT NULL," + |
|
|
|
" entity_type varchar(32) NOT NULL," + |
|
|
|
" entity_id uuid NOT NULL," + |
|
|
|
" state_data varchar(16384) NOT NULL," + |
|
|
|
" CONSTRAINT rule_node_state_unq_key UNIQUE (rule_node_id, entity_id)," + |
|
|
|
" CONSTRAINT fk_rule_node_state_node_id FOREIGN KEY (rule_node_id) REFERENCES rule_node(id) ON DELETE CASCADE)"); |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
|
|
|
|
schemaUpdateFile = Paths.get(installScripts.getDataDir(), "upgrade", "3.1.2", "schema_update_before.sql"); |
|
|
|
loadSql(schemaUpdateFile, conn); |
|
|
|
|
|
|
|
@ -357,7 +370,8 @@ public class SqlDatabaseUpgradeService implements DatabaseEntitiesUpgradeService |
|
|
|
List<EntitySubtype> deviceTypes = deviceService.findDeviceTypesByTenantId(tenant.getId()).get(); |
|
|
|
try { |
|
|
|
deviceProfileService.createDefaultDeviceProfile(tenant.getId()); |
|
|
|
} catch (Exception e){} |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
for (EntitySubtype deviceType : deviceTypes) { |
|
|
|
try { |
|
|
|
deviceProfileService.findOrCreateDeviceProfile(tenant.getId(), deviceType.getType()); |
|
|
|
|