mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-06 14:26:28 +00:00
parent
726f7ddf27
commit
2f84bfbfa8
@ -109,4 +109,10 @@ DELETE FROM entity_extension
|
|||||||
WHERE jsonSchema IN ('tableProfile', 'columnTest', 'tableTest');
|
WHERE jsonSchema IN ('tableProfile', 'columnTest', 'tableTest');
|
||||||
|
|
||||||
DELETE FROM ingestion_pipeline_entity
|
DELETE FROM ingestion_pipeline_entity
|
||||||
WHERE LOWER(JSON_EXTRACT(json, '$.pipelineType') = 'profiler');
|
WHERE LOWER(JSON_EXTRACT(json, '$.pipelineType') = 'profiler');
|
||||||
|
|
||||||
|
DELETE FROM role_entity;
|
||||||
|
DELETE FROM policy_entity;
|
||||||
|
DELETE FROM field_relationship WHERE fromType IN ('role', 'policy') OR toType IN ('role', 'policy');
|
||||||
|
DELETE FROM entity_relationship WHERE fromEntity IN ('role', 'policy') OR toEntity IN ('role', 'policy');
|
||||||
|
ALTER TABLE role_entity DROP COLUMN defaultRole;
|
||||||
|
@ -105,3 +105,9 @@ WHERE jsonSchema IN ('tableProfile', 'columnTest', 'tableTest');
|
|||||||
|
|
||||||
DELETE FROM ingestion_pipeline_entity
|
DELETE FROM ingestion_pipeline_entity
|
||||||
WHERE json_extract_path_text("json", 'pipelineType') = 'profiler';
|
WHERE json_extract_path_text("json", 'pipelineType') = 'profiler';
|
||||||
|
|
||||||
|
DELETE FROM role_entity;
|
||||||
|
DELETE FROM policy_entity;
|
||||||
|
DELETE FROM field_relationship WHERE fromType IN ('role', 'policy') OR toType IN ('role', 'policy');
|
||||||
|
DELETE FROM entity_relationship WHERE fromEntity IN ('role', 'policy') OR toEntity IN ('role', 'policy');
|
||||||
|
ALTER TABLE role_entity DROP COLUMN defaultRole;
|
||||||
|
@ -1125,7 +1125,10 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
|||||||
this.original = original;
|
this.original = original;
|
||||||
this.updated = updated;
|
this.updated = updated;
|
||||||
this.operation = operation;
|
this.operation = operation;
|
||||||
this.updatingUser = SubjectCache.getInstance().getSubjectContext(updated.getUpdatedBy()).getUser();
|
this.updatingUser =
|
||||||
|
updated.getUpdatedBy().equalsIgnoreCase("admin")
|
||||||
|
? new User().withName("admin").withIsAdmin(true)
|
||||||
|
: SubjectCache.getInstance().getSubjectContext(updated.getUpdatedBy()).getUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compare original and updated entities and perform updates. Update the entity version and track changes. */
|
/** Compare original and updated entities and perform updates. Update the entity version and track changes. */
|
||||||
|
@ -328,21 +328,21 @@ public class TeamRepository extends EntityRepository<Team> {
|
|||||||
String json = dao.findJsonByFqn(ORGANIZATION_NAME, Include.ALL);
|
String json = dao.findJsonByFqn(ORGANIZATION_NAME, Include.ALL);
|
||||||
if (json == null) {
|
if (json == null) {
|
||||||
LOG.debug("Organization {} is not initialized", ORGANIZATION_NAME);
|
LOG.debug("Organization {} is not initialized", ORGANIZATION_NAME);
|
||||||
EntityReference organizationPolicy = Entity.getEntityReferenceByName(POLICY, "OrganizationPolicy", Include.ALL);
|
|
||||||
EntityReference dataConsumerRole = Entity.getEntityReferenceByName(ROLE, "DataConsumer", Include.ALL);
|
|
||||||
Team team =
|
|
||||||
new Team()
|
|
||||||
.withId(UUID.randomUUID())
|
|
||||||
.withName(ORGANIZATION_NAME)
|
|
||||||
.withDisplayName(ORGANIZATION_NAME)
|
|
||||||
.withDescription("Organization under which all the other team hierarchy is created")
|
|
||||||
.withTeamType(ORGANIZATION)
|
|
||||||
.withUpdatedBy("admin")
|
|
||||||
.withUpdatedAt(System.currentTimeMillis())
|
|
||||||
.withPolicies(new ArrayList<>(List.of(organizationPolicy)))
|
|
||||||
.withDefaultRoles(new ArrayList<>(List.of(dataConsumerRole)));
|
|
||||||
// Teams
|
// Teams
|
||||||
try {
|
try {
|
||||||
|
EntityReference organizationPolicy = Entity.getEntityReferenceByName(POLICY, "OrganizationPolicy", Include.ALL);
|
||||||
|
EntityReference dataConsumerRole = Entity.getEntityReferenceByName(ROLE, "DataConsumer", Include.ALL);
|
||||||
|
Team team =
|
||||||
|
new Team()
|
||||||
|
.withId(UUID.randomUUID())
|
||||||
|
.withName(ORGANIZATION_NAME)
|
||||||
|
.withDisplayName(ORGANIZATION_NAME)
|
||||||
|
.withDescription("Organization under which all the other team hierarchy is created")
|
||||||
|
.withTeamType(ORGANIZATION)
|
||||||
|
.withUpdatedBy("admin")
|
||||||
|
.withUpdatedAt(System.currentTimeMillis())
|
||||||
|
.withPolicies(new ArrayList<>(List.of(organizationPolicy)))
|
||||||
|
.withDefaultRoles(new ArrayList<>(List.of(dataConsumerRole)));
|
||||||
organization = create(null, team);
|
organization = create(null, team);
|
||||||
LOG.info("Organization {}:{} is successfully initialized", ORGANIZATION_NAME, organization.getId());
|
LOG.info("Organization {}:{} is successfully initialized", ORGANIZATION_NAME, organization.getId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -111,7 +111,7 @@ public class TypeResource extends EntityResource<Type, TypeRepository> {
|
|||||||
}
|
}
|
||||||
this.dao.createOrUpdate(null, type);
|
this.dao.createOrUpdate(null, type);
|
||||||
this.dao.addToRegistry(type);
|
this.dao.addToRegistry(type);
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error loading type {}", type.getName(), e);
|
LOG.error("Error loading type {}", type.getName(), e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user