Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: integration should be unique per environment (#1889)
The unique constraint for integration is for unique_key, environment_id and deleted_at which can be null. However null values are not considered equal by default by postgres. 🤯 from postgres doc at https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS > By default, two null values are not considered equal in this comparison. That means even in the presence of a unique constraint it is possible to store duplicate rows that contain a null value in at least one of the constrained columns. This behavior can be changed by adding the clause NULLS NOT DISTINCT With this constraint, editing a integration with a name that already exists shows an error ## Issue ticket number and link https://linear.app/nango/issue/NAN-615/user-managed-to-create-two-integrations-with-the-same-integration-id ## Checklist before requesting a review (skip if just adding/editing APIs & templates) - [ ] I added tests, otherwise the reason is: - [ ] I added observability, otherwise the reason is: - [ ] I added analytics, otherwise the reason is:
- Loading branch information