on dev help sign in
small change
commit0120fc6b19aaf37b3d02c1704b9e2821090cfd21 authorEitan Chatav <eitan.chatav@gmail.com> dateMon 9 Apr 2018, 10:38 (9 years ago) parentb9103f4
2 files changed+6−5
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs−1 squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+6−4
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs−1
@@ -403,7 +403,6 @@ type ForeignKeyed schema
403403 , reftable ~ (constraints :=> cols)
404404 , HasAll refcolumns cols reftys
405405 , SOP.AllZip SamePGType tys reftys
406− , AllNotNull reftys
407406 , Uniquely refcolumns constraints )
408407
409408-- | `OnDeleteClause` indicates what to do with rows that reference a deleted row.
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+6−4
@@ -249,12 +249,14 @@ type TableConstraints = [(Symbol,TableConstraint)]
249249type family NilTableConstraints :: TableConstraints where
250250 NilTableConstraints = '[]
251251
252+-- | A `ForeignKey` must reference columns that either are
253+-- a `PrimaryKey` or form a `Unique` constraint.
252254type family Uniquely
253− (keys :: [Symbol])
255+ (key :: [Symbol])
254256 (constraints :: TableConstraints) :: Constraint where
255− Uniquely keys (uq ::: 'Unique keys ': constraints) = ()
256− Uniquely keys (uq ::: 'PrimaryKey keys ': constraints) = ()
257− Uniquely keys (_ ': constraints) = Uniquely keys constraints
257+ Uniquely key (uq ::: 'Unique key ': constraints) = ()
258+ Uniquely key (pk ::: 'PrimaryKey key ': constraints) = ()
259+ Uniquely key (_ ': constraints) = Uniquely key constraints
258260
259261-- | `TableType` encodes a row of constraints on a table as well as the types
260262-- of its columns.