Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the result we see the id = 5.  For future reference, this will be refered referred to as the domain_id

Try and delete the domain by executing the following query:

Code Block
languagetext
themeConfluence
delete from domain where name =  'spt.deepnetid.com'

For future reference, this will be referred to as the first query


You will now see an error which should give details as to why the domain cannot be deleted... for example...

...

Code Block
languagetext
themeConfluence
delete from role_domain where domain_id = 5

Hopefully you will see 1 row affected, which means that query has executed correctly and reference to the domain has been deleted from this table

Run the first query again.

Image Added

This error tells us that a foreign key constraint fails where the domain_id is referenced in the table usergroup


Code Block
languagetext
themeConfluence
delete from usergroup where domain_id = 5


Unfortunately, that query returns the following error...

Image Added

...because there is row in ldap_group that is referencing the id in a row of the usergroup table we need to delete.  Therefor taht row in the ldap_group table needs to be deleted first.

Expand
titleThe follwing diagram explains it better...

Image Added

The row where id = 7 in th ldap_group table needs to be deleted first, before the row with the same id on the usergroup table (which also references that domain_id) can be deleted.



Only the usergroup table contains the column domain_id; therefore the only way to delete the related row in ldap_group is  by matching it to where the  domain_id = 5 in the usergroup table via a join query:

Code Block
languagetext
themeConfluence
DELETE lg FROM ldap_group lg
JOIN usergroup ug ON lg.id = ug.id
WHERE ug.domain_id = 5;