Remove association between ChatName and Integration - Step 1: make it optional
This issue is part of the epic &9418 (closed). See that epic for more details.
About
We want to remove the association between a ChatName
and an Integration
in order to be able to identify users in Slack without a project or integration.
In this issue, we can make the association between ChatName
and Integration
optional in database modelling.
The next step in #384973 (closed) will be to modify the code to stop associating ChatName
and Integration
records, and finally, we will drop the database chat_names.integration_id
column later in #384974 (closed).
Proposal
- Remove the
integration_id
foreign key fromchat_names
. Follow our process for removing a foreign key constraint. - Change some of the indexes on the table:
- Drop the existing UNIQUE index on
(integration_id, team_id, chat_id)
- Replace the UNIQUE index on
(user_id, integration_id)
index with a non-unique index just onuser_id
. Do this by adding the non-unique index, and then in a second migration drop the other one.
- Drop the existing UNIQUE index on
- Update the validations in
ChatName
:- Remove the uniqueness validation on
:user_id
that is scoped tointegration_id
. - Change the uniqueness validation on
:chat_id
so that it is scoped only to:team_id
.
- Remove the uniqueness validation on
Edited by Luke Duncalfe