func_key_dest_conference must be deleted when tenant deleted

Description

we must check func_key_dest_conference as error raised during wazo-upgrade:

 

Zendesk Ticket IDs

None

Activity

Show:

Charles Langlois November 16, 2023 at 8:01 PM

Tenant deletion also takes care of all func key / conference entities.

Charles Langlois November 16, 2023 at 7:53 PM

Managed to test successfully from portal:
1. create conference
2. create phone key template with “func key” pointing to conference
3. delete conference
4. phone key template still exists, but func key no longer exists(template is empty) and no errors are generated

Nabil Ben Youssef November 14, 2023 at 4:23 PM
Edited

With the lastest version of the API:

  • when creating a conference

  • when creating a func key template having the conference as destination

=>

There is no delete cascade: so when deleting a conference, the related func_key_dest_conference is not deleted=> error is still referenced

 

Ticket created

Nabil Ben Youssef November 14, 2023 at 3:32 PM
Edited

func_key rows must not be deleted, as created by xivo-manage-db/populate/populate.sql (https://github.com/wazo-platform/xivo-manage-db/blob/1d5e9f59b9f18b8bfa973f063b6af4880a085812/populate/populate.sql#L97)

These rows should be seen as a catalog of functional keys for any tenants.

 

Same comment for func_key_destination_type and func_key_type , they are created by populate.sql, they should not be deleted.

Nabil Ben Youssef November 9, 2023 at 7:58 PM
Edited

When a conference is deleted, the func_key_dest_conference can be deleted too, but not the func_key.

To be more precised, the following tables remain:

  • func_keys ,

  • func_key_mapping

  • and the func_key_template

Below the schema of the table func_key:

As you can see, the func_key doesn’t point to a specific table , but many tables referer to it.

Done

Details

Priority

Assignee

Reporter

Approvers

Nabil Ben Youssef

Pair

Charles Langlois

Fix versions

Sprint

Zendesk Support

Created October 31, 2023 at 9:37 PM
Updated November 23, 2023 at 6:40 PM
Resolved November 17, 2023 at 7:52 PM