You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
both entities get updated in different streams and product becomes valid when price is there and so on. This is solved application side in the further processing pipeline.
Obviously this is an optional association that does not have to be there.
Result
This setup works in use. Price is optionally loaded when it is there, otherwise nil.
However AutoMigrate fails on existing data. Gorm tries to generate a foreign key restraint. However as the relation is optional not all entries have a matching entry, but due to unique key composition in each table the postgres constraint implicitly is a hard dependency which then fails on the data because none of the columns can be null in either table.
Expected answer
Is there a way to modify the foreign key creation for postgres or suppress creating a hard database constraint in the auto migration for postgres?
Probably I simply would like to have the association, but not have AutoMigrate generate a constraint.
The text was updated successfully, but these errors were encountered:
Your Question
So I have the following base structure of two entities, that can be connected via three columns:
both entities get updated in different streams and product becomes valid when price is there and so on. This is solved application side in the further processing pipeline.
Obviously this is an optional association that does not have to be there.
Result
This setup works in use. Price is optionally loaded when it is there, otherwise nil.
However AutoMigrate fails on existing data. Gorm tries to generate a foreign key restraint. However as the relation is optional not all entries have a matching entry, but due to unique key composition in each table the postgres constraint implicitly is a hard dependency which then fails on the data because none of the columns can be null in either table.
Expected answer
Is there a way to modify the foreign key creation for postgres or suppress creating a hard database constraint in the auto migration for postgres?
Probably I simply would like to have the association, but not have AutoMigrate generate a constraint.
The text was updated successfully, but these errors were encountered: