Commit

860ae7a

Name a Postgres unique constraint email_unique on two tables and the second fails: "relation already exists". Check names are per table; anything backed by an index is per schema. Constraint naming, tested on 18.3, on the Schemity blog. https://schemity.com/blog/postgres-constraint-naming-convention/
schemity.comPostgreSQL Constraint Naming Convention: Which Pattern to Use, and How to Find the Names That Drifted - SchemitySchemity's guide to naming Postgres constraints and indexes: the pattern to pick, the 63-byte cut that makes two names collide, and a query for stale names.

commit 860ae7a

Constraints are per-table, indexes are per-schema. A UNIQUE constraint creates a matching index, so reusing the same name on a second table collides on the index → relation already exists. Fix: name constraints per table, e.g. customers_email_unique, users_email_unique.