Skip to content

Conversation

@s-sokolko
Copy link

When using atlas migrate diff and the schema contains partitioned tables the autogenerated migration sometimes contains duplicate foreign key constraints. It happens when there is a foreign key in DB schema that references a partitioned table. In this case the foreign key search sql filters tables by the source table of the FK only, But we have to filter also by the target table, because if we don't the query also gives us all the partitions of tha partitioned table aprat from the partitioned table itself.
I've faced this situation using Postgres. My fix adds checks and some query formatting.

@a8m
Copy link
Member

a8m commented Sep 12, 2024

Thanks for the contribution, @s-sokolko.

However, I won’t merge this as it conflicts with our current work on supporting partitions (which should be released soon). I appreciate your effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants