on dev help sign in
omg that looks so nice
8d2df16Eitan Chatav
README.md+3−3
@@ -128,13 +128,13 @@ let
128 createTable #users
128 createTable #users
129 ( serial `As` #id :*
129 ( serial `As` #id :*
130 (text & notNull) `As` #name :* Nil )
130 (text & notNull) `As` #name :* Nil )
131− ( primaryKey (#id :* Nil) `As` #pk_users :* Nil ) >>>
131+ ( primaryKey #id `As` #pk_users :* Nil ) >>>
132 createTable #emails
132 createTable #emails
133 ( serial `As` #id :*
133 ( serial `As` #id :*
134 (int & notNull) `As` #user_id :*
134 (int & notNull) `As` #user_id :*
135 text `As` #email :* Nil )
135 text `As` #email :* Nil )
136− ( primaryKey (#id :* Nil) `As` #pk_emails :*
136+ ( primaryKey #id `As` #pk_emails :*
137− foreignKey (#user_id :* Nil) #users (#id :* Nil)
137+ foreignKey #user_id #users #id
138 OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
138 OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
139:}
139:}
140```
140```
squeal-postgresql/exe/Example.hs+3−3
@@ -47,14 +47,14 @@ setup =
47 ( serial `As` #id :*
47 ( serial `As` #id :*
48 (text & notNull) `As` #name :*
48 (text & notNull) `As` #name :*
49 (vararray int2 & notNull) `As` #vec :* Nil )
49 (vararray int2 & notNull) `As` #vec :* Nil )
50− ( primaryKey (#id :* Nil) `As` #pk_users :* Nil )
50+ ( primaryKey #id `As` #pk_users :* Nil )
51 >>>
51 >>>
52 createTable #emails
52 createTable #emails
53 ( serial `As` #id :*
53 ( serial `As` #id :*
54 (int & notNull) `As` #user_id :*
54 (int & notNull) `As` #user_id :*
55 text `As` #email :* Nil )
55 text `As` #email :* Nil )
56− ( primaryKey (#id :* Nil) `As` #pk_emails :*
56+ ( primaryKey #id `As` #pk_emails :*
57− foreignKey (#user_id :* Nil) #users (#id :* Nil)
57+ foreignKey #user_id #users #id
58 OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
58 OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
59
59
60teardown :: Definition Schema '[]
60teardown :: Definition Schema '[]
squeal-postgresql/src/Squeal/PostgreSQL.hs+3−3
@@ -67,13 +67,13 @@
67-- createTable #users
67-- createTable #users
68-- ( serial `As` #id :*
68-- ( serial `As` #id :*
69-- (text & notNull) `As` #name :* Nil )
69-- (text & notNull) `As` #name :* Nil )
70−-- ( primaryKey (#id :* Nil) `As` #pk_users :* Nil ) >>>
70+-- ( primaryKey #id `As` #pk_users :* Nil ) >>>
71-- createTable #emails
71-- createTable #emails
72-- ( serial `As` #id :*
72-- ( serial `As` #id :*
73-- (int & notNull) `As` #user_id :*
73-- (int & notNull) `As` #user_id :*
74-- text `As` #email :* Nil )
74-- text `As` #email :* Nil )
75−-- ( primaryKey (#id :* Nil) `As` #pk_emails :*
75+-- ( primaryKey #id `As` #pk_emails :*
76−-- foreignKey (#user_id :* Nil) #users (#id :* Nil)
76+-- foreignKey #user_id #users #id
77-- OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
77-- OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
78-- :}
78-- :}
79--
79--
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+4−4
@@ -279,7 +279,7 @@ unique columns = UnsafeTableConstraintExpression $
279-- definition = createTable #tab
279-- definition = createTable #tab
280-- ( serial `As` #id :*
280-- ( serial `As` #id :*
281-- (text & notNull) `As` #name :* Nil )
281-- (text & notNull) `As` #name :* Nil )
282−-- ( primaryKey (#id :* Nil) `As` #pk_id :* Nil )
282+-- ( primaryKey #id `As` #pk_id :* Nil )
283-- :}
283-- :}
284--
284--
285-- >>> renderDefinition definition
285-- >>> renderDefinition definition
@@ -322,13 +322,13 @@ primaryKey columns = UnsafeTableConstraintExpression $
322-- createTable #users
322-- createTable #users
323-- ( serial `As` #id :*
323-- ( serial `As` #id :*
324-- (text & notNull) `As` #name :* Nil )
324-- (text & notNull) `As` #name :* Nil )
325−-- ( primaryKey (#id :* Nil) `As` #pk_users :* Nil ) >>>
325+-- ( primaryKey #id `As` #pk_users :* Nil ) >>>
326-- createTable #emails
326-- createTable #emails
327-- ( serial `As` #id :*
327-- ( serial `As` #id :*
328-- (int & notNull) `As` #user_id :*
328-- (int & notNull) `As` #user_id :*
329-- text `As` #email :* Nil )
329-- text `As` #email :* Nil )
330−-- ( primaryKey (#id :* Nil) `As` #pk_emails :*
330+-- ( primaryKey #id `As` #pk_emails :*
331−-- foreignKey (#user_id :* Nil) #users (#id :* Nil)
331+-- foreignKey #user_id #users #id
332-- OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
332-- OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
333-- in renderDefinition setup
333-- in renderDefinition setup
334-- :}
334-- :}
squeal-postgresql/src/Squeal/PostgreSQL/Migration.hs+3−3
@@ -38,7 +38,7 @@ let
38 createTable #users
38 createTable #users
39 ( serial `As` #id :*
39 ( serial `As` #id :*
40 (text & notNull) `As` #name :* Nil )
40 (text & notNull) `As` #name :* Nil )
41− ( primaryKey (#id :* Nil) `As` #pk_users :* Nil )
41+ ( primaryKey #id `As` #pk_users :* Nil )
42 , down = void . define $ dropTable #users
42 , down = void . define $ dropTable #users
43 }
43 }
44:}
44:}
@@ -54,8 +54,8 @@ let
54 ( serial `As` #id :*
54 ( serial `As` #id :*
55 (int & notNull) `As` #user_id :*
55 (int & notNull) `As` #user_id :*
56 text `As` #email :* Nil )
56 text `As` #email :* Nil )
57− ( primaryKey (#id :* Nil) `As` #pk_emails :*
57+ ( primaryKey #id `As` #pk_emails :*
58− foreignKey (#user_id :* Nil) #users (#id :* Nil)
58+ foreignKey #user_id #users #id
59 OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
59 OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
60 , down = void . define $ dropTable #emails
60 , down = void . define $ dropTable #emails
61 }
61 }
squeal-postgresql/src/Squeal/PostgreSQL/Schema.hs+2
@@ -362,6 +362,8 @@ data Alias (alias :: Symbol) = Alias
362 deriving (Eq,GHC.Generic,Ord,Show,NFData)
362 deriving (Eq,GHC.Generic,Ord,Show,NFData)
363instance alias1 ~ alias2 => IsLabel alias1 (Alias alias2) where
363instance alias1 ~ alias2 => IsLabel alias1 (Alias alias2) where
364 fromLabel = Alias
364 fromLabel = Alias
365+instance aliases ~ '[alias] => IsLabel alias (SOP.NP Alias aliases) where
366+ fromLabel = fromLabel SOP.:* SOP.Nil
365
367
366-- | >>> renderAlias #jimbob
368-- | >>> renderAlias #jimbob
367-- "\"jimbob\""
369-- "\"jimbob\""