Prevent writing multiple funnels with same name
This MR is to prevent a scenario where funnels table might end up with multiple records having same name.
Scenario:
- There is a funnel with a name
funnel_1
in database - Server receives an
update
request with namefunnel_1
and previous_namesomething_else
- Server at first deletes the funnel with previous name, which doesn't exist so no action
- Server adds a new record with
name
. Since primary keys inclickhouse
is not unique, insert succeeds resulting in two funnels with namefunnel_1
This is a scenario unlikely to happen. However, it can occur after the funnel name MR in Gitlab repo is deployed in the following scenario.
- A funnel with
name
attributeFunnel 1
and a file namesomething_else.yaml
exists in a repository before the deployment of funnel name MR in Gitlab repo. - User renames the file to
funnel_1.yaml