Closed hatati closed 2 years ago
If I create a new domain then I am able to delete it:
@hatati - a domain can't be deleted if there are objects associated to the domain. A message should be displayed listing the objects that need to be removed first. We will debug this to see what is happening. Another option is to change the code to delete the domain and the associated objects for you.
@sbtaylor15 - Initially a list of objects in the domain would be nice to have when trying to delete it so a user can manually delete them. An option to delete them automatically would also be nice, but a confirmation dialog should be added to this.
@hatati - please make sure that you have this function defined. And then run the second query (updating the domain name you want to delete). Running this outside of the UI will expose where the delete is having issues.
CREATE OR REPLACE FUNCTION dm.fulldomain(
val integer)
RETURNS character varying
LANGUAGE 'plpgsql'
COST 100
VOLATILE PARALLEL UNSAFE
AS $BODY$
DECLARE full_domain varchar;
BEGIN
WITH RECURSIVE pops (id, level, name, name_path) AS (
SELECT id, 0, name, ARRAY[name]
FROM dm.dm_domain a
WHERE a.domainid is null
UNION ALL
SELECT p.id, t0.level + 1, p.name, ARRAY_APPEND(t0.name_path, p.name)
FROM dm.dm_domain p
INNER JOIN pops t0 ON t0.id = p.domainid
)
SELECT ARRAY_TO_STRING(name_path, '.') into full_domain
FROM pops where id = $1;
RETURN full_domain;
END;
$BODY$;
ALTER FUNCTION dm.fulldomain(integer)
OWNER TO postgres;
begin;
delete from dm.dm_componentitem where id in (select b.id from dm.dm_component a, dm.dm_componentitem b where a.id = b.compid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_componentvars where compid in (select b.compid from dm.dm_component a, dm.dm_componentvars b where a.id = b.compid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_applicationcomponent where compid in (select b.compid from dm.dm_component a, dm.dm_applicationcomponent b where a.id = b.compid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_component a where fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%';
delete from dm.dm_appsallowedinenv where appid in (select b.appid from dm.dm_application a, dm.dm_appsallowedinenv b where a.id = b.appid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_applicationvars where appid in (select b.appid from dm.dm_application a, dm.dm_applicationvars b where a.id = b.appid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_application a where fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%';
delete from dm.dm_environmentvars where envid in (select b.envid from dm.dm_environment a, dm.dm_environmentvars b where a.id = b.envid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_serversinenv where envid in (select b.envid from dm.dm_environment a, dm.dm_serversinenv b where a.id = b.envid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_environment a where fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%';
delete from dm.dm_usersingroup where userid in (select b.userid from dm.dm_user a, dm.dm_usersingroup b where a.id = b.userid and fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%');
delete from dm.dm_user a where fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%';
delete from dm.dm_domain where id in (select id from dm.dm_domain a where fulldomain(a.domainid) like 'GLOBAL.Src Consulting.%' order by fulldomain(a.domainid) || '.' || name desc);
delete from dm.dm_domain where id in (select id from dm.dm_domain a where fulldomain(a.domainid) || '.' || name = 'GLOBAL.Src Consulting' order by fulldomain(a.domainid) || '.' || name desc);
delete from dm.dm_task where domainid not in (select id from dm.dm_domain);
delete from dm.dm_engine where domainid not in (select id from dm.dm_domain);
commit;
When I try to delete a domain nothing happens. Watch the below gif for example:
The UI is successfully sending a request:
The container logs shows that it's trying to delete the domain, but nothing happens:
Deployhub image tag: ui-skin-v9.0.0.3271-g1077e12