Prisma join tables unable to be replicated by default #25196
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
domain/schema
Issue in the "Schema" domain: Prisma Schema, Introspection, Migrations etc.
kind/bug
A reported bug.
topic: breaking change
topic: read replica
Bug description
(Creating an issue from my comment on this closed issue.)
Due to Prisma relation tables not having a primary key and due to the default replica identity behaviour these tables are not able to be replicated without further manual configuration.
Prisma relation tables use a unique index on the two columns A and B and so theoretically the
REPLICA IDENTITY FULL
should be able to perform without issue as this constraint will prevent duplicate records which would impact data consistency.I see a few options for a resolution:
ALTER TABLE x REPLICA IDENTITY FULL
in the SQL for creation of these tables in migrationsMy preference would be 2 as it is the least effort (for users and Prisma devs) and means future join table schemas will not diverge from the current schema.
How to reproduce
Expected behavior
I would expect Prisma would make some consideration for the scenario of logical replication of join tables such that this error does not occur.
Prisma information
n/a
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: