Merged
Merged
Conversation
Comment on lines -34 to -48
| it "checkUniqueUpdateable" $ runDb $ do | ||
| let f = 3 | ||
| let b = 5 | ||
| let fo = Fo f b | ||
| k <- insert fo | ||
| Just _ <- checkUnique fo -- conflicts with itself | ||
|
|
||
| let fo' = Fo (f + 1) b | ||
| Just _ <- checkUnique fo' -- conflicts with fo | ||
| Nothing <- checkUniqueUpdateable $ Entity k fo' -- but fo can be updated to fo' | ||
|
|
||
| let fo'' = Fo (f + 1) (b + 1) | ||
| insert_ fo'' | ||
| Just (UniqueBar conflict) <- checkUniqueUpdateable $ Entity k fo'' -- fo can't be updated to fo'' | ||
| conflict @== b + 1 |
| -- @since.2.13.0.0 | ||
| data UnboundCompositeDef = UnboundCompositeDef | ||
| { unboundCompositeCols :: [FieldNameHS] | ||
| { unboundCompositeCols :: NonEmpty FieldNameHS |
Comment on lines +995 to +996
| -> ([Column], [UniqueDef], [ForeignDef]) | ||
| mkColumns allDefs t overrides = | ||
| (cols, getEntityUniques t, getEntityForeignDefs t) | ||
| (cols, getEntityUniquesNoPrimaryKey t, getEntityForeignDefs t) |
| where | ||
| parentKeyFieldNames | ||
| :: [(FieldNameHS, FieldNameDB)] | ||
| :: NonEmpty (FieldNameHS, FieldNameDB) |
Comment on lines +397 to +408
| entityUniques (unboundEntityDef user) `shouldBe` | ||
| [ UniqueDef | ||
| { uniqueHaskell = | ||
| ConstraintNameHS "UserPrimaryKey" | ||
| , uniqueDBName = | ||
| ConstraintNameDB "primary_key" | ||
| , uniqueFields = | ||
| pure (FieldNameHS "ref", FieldNameDB "ref") | ||
| , uniqueAttrs = | ||
| [] | ||
| } | ||
| ] |
Closed
Labels
None yet