Commit c78bd55df5c866125b156d1841fc58dd41262f69

Authored by YevhenBondarenko
1 parent 616839a2

added resource table to hsql schema

... ... @@ -35,6 +35,7 @@ import org.thingsboard.server.dao.device.DeviceService;
35 35 import org.thingsboard.server.dao.entity.AbstractEntityService;
36 36 import org.thingsboard.server.dao.entityview.EntityViewService;
37 37 import org.thingsboard.server.dao.exception.DataValidationException;
  38 +import org.thingsboard.server.dao.resource.ResourceService;
38 39 import org.thingsboard.server.dao.rule.RuleChainService;
39 40 import org.thingsboard.server.dao.service.DataValidator;
40 41 import org.thingsboard.server.dao.service.PaginatedRemover;
... ... @@ -88,6 +89,9 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe
88 89 @Autowired
89 90 private RuleChainService ruleChainService;
90 91
  92 + @Autowired
  93 + private ResourceService resourceService;
  94 +
91 95 @Override
92 96 public Tenant findTenantById(TenantId tenantId) {
93 97 log.trace("Executing findTenantById [{}]", tenantId);
... ... @@ -140,6 +144,7 @@ public class TenantServiceImpl extends AbstractEntityService implements TenantSe
140 144 userService.deleteTenantAdmins(tenantId);
141 145 ruleChainService.deleteRuleChainsByTenantId(tenantId);
142 146 apiUsageStateService.deleteApiUsageStateByTenantId(tenantId);
  147 + resourceService.deleteResourcesByTenantId(tenantId);
143 148 tenantDao.removeById(tenantId, tenantId.getId());
144 149 deleteEntityRelations(tenantId, tenantId);
145 150 }
... ...
... ... @@ -420,3 +420,11 @@ CREATE TABLE IF NOT EXISTS api_usage_state (
420 420 sms_exec varchar(32),
421 421 CONSTRAINT api_usage_state_unq_key UNIQUE (tenant_id, entity_id)
422 422 );
  423 +
  424 +CREATE TABLE IF NOT EXISTS resource (
  425 + tenant_id uuid NOT NULL,
  426 + resource_type varchar(32) NOT NULL,
  427 + resource_id varchar(255) NOT NULL,
  428 + resource_value varchar,
  429 + CONSTRAINT resource_unq_key UNIQUE (tenant_id, resource_type, resource_id)
  430 +);
... ...
... ... @@ -28,4 +28,5 @@ DROP TABLE IF EXISTS oauth2_client_registration;
28 28 DROP TABLE IF EXISTS oauth2_client_registration_info;
29 29 DROP TABLE IF EXISTS oauth2_client_registration_template;
30 30 DROP TABLE IF EXISTS api_usage_state;
  31 +DROP TABLE IF EXISTS resource;
31 32 DROP FUNCTION IF EXISTS to_uuid;
... ...
... ... @@ -28,4 +28,5 @@ DROP TABLE IF EXISTS tb_schema_settings;
28 28 DROP TABLE IF EXISTS oauth2_client_registration;
29 29 DROP TABLE IF EXISTS oauth2_client_registration_info;
30 30 DROP TABLE IF EXISTS oauth2_client_registration_template;
31   -DROP TABLE IF EXISTS api_usage_state;
\ No newline at end of file
  31 +DROP TABLE IF EXISTS api_usage_state;
  32 +DROP TABLE IF EXISTS resource;
... ...