@@ -244,9 +244,9 @@ type Schema = '[
245 definition :: Definition '[] Schema
245 definition :: Definition '[] Schema
246 definition = createTable #tab
246 definition = createTable #tab
247− ( (int & notNullable) `As` #a :*
247+ ( (int & notNullable) `as` #a :*
248− (int & notNullable) `As` #b :* Nil )
248+ (int & notNullable) `as` #b )
249− ( check (#a :* #b :* Nil) (#a .> #b) `As` #inequality :* Nil )
249+ ( check (#a :* #b) (#a .> #b) `as` #inequality )
252>>> printSQL definition
252>>> printSQL definition
@@ -278,9 +278,9 @@ type Schema = '[
279 definition :: Definition '[] Schema
279 definition :: Definition '[] Schema
280 definition = createTable #tab
280 definition = createTable #tab
281− ( (int & nullable) `As` #a :*
281+ ( (int & nullable) `as` #a :*
282− (int & nullable) `As` #b :* Nil )
282+ (int & nullable) `as` #b )
283− ( unique (#a :* #b :* Nil) `As` #uq_a_b :* Nil )
283+ ( unique (#a :* #b) `as` #uq_a_b )
286>>> printSQL definition
286>>> printSQL definition
@@ -311,9 +311,9 @@ type Schema = '[
312 definition :: Definition '[] Schema
312 definition :: Definition '[] Schema
313 definition = createTable #tab
313 definition = createTable #tab
314− ( serial `As` #id :*
314+ ( serial `as` #id :*
315− (text & notNullable) `As` #name :* Nil )
315+ (text & notNullable) `as` #name )
316− ( primaryKey #id `As` #pk_id :* Nil )
316+ ( primaryKey #id `as` #pk_id )
319>>> printSQL definition
319>>> printSQL definition
@@ -357,16 +357,16 @@ let
357 setup :: Definition '[] Schema
357 setup :: Definition '[] Schema
359 createTable #users
359 createTable #users
360− ( serial `As` #id :*
360+ ( serial `as` #id :*
361− (text & notNullable) `As` #name :* Nil )
361+ (text & notNullable) `as` #name )
362− ( primaryKey #id `As` #pk_users :* Nil ) >>>
362+ ( primaryKey #id `as` #pk_users ) >>>
363 createTable #emails
363 createTable #emails
364− ( serial `As` #id :*
364+ ( serial `as` #id :*
365− (int & notNullable) `As` #user_id :*
365+ (int & notNullable) `as` #user_id :*
366− (text & nullable) `As` #email :* Nil )
366+ (text & nullable) `as` #email )
367− ( primaryKey #id `As` #pk_emails :*
367+ ( primaryKey #id `as` #pk_emails :*
368 foreignKey #user_id #users #id
368 foreignKey #user_id #users #id
369− OnDeleteCascade OnUpdateCascade `As` #fk_user_id :* Nil )
369+ OnDeleteCascade OnUpdateCascade `as` #fk_user_id )
370in printSQL setup
370in printSQL setup
372CREATE TABLE "users" ("id" serial, "name" text NOT NULL, CONSTRAINT "pk_users" PRIMARY KEY ("id"));
372CREATE TABLE "users" ("id" serial, "name" text NOT NULL, CONSTRAINT "pk_users" PRIMARY KEY ("id"));
@@ -392,12 +392,12 @@ let
392 setup :: Definition '[] Schema
392 setup :: Definition '[] Schema
394 createTable #employees
394 createTable #employees
395− ( serial `As` #id :*
395+ ( serial `as` #id :*
396− (text & notNullable) `As` #name :*
396+ (text & notNullable) `as` #name :*
397− (integer & nullable) `As` #employer_id :* Nil )
397+ (integer & nullable) `as` #employer_id )
398− ( primaryKey #id `As` #employees_pk :*
398+ ( primaryKey #id `as` #employees_pk :*
399 foreignKey #employer_id #employees #id
399 foreignKey #employer_id #employees #id
400− OnDeleteCascade OnUpdateCascade `As` #employees_employer_fk :* Nil )
400+ OnDeleteCascade OnUpdateCascade `as` #employees_employer_fk )
401in printSQL setup
401in printSQL setup
403CREATE TABLE "employees" ("id" serial, "name" text NOT NULL, "employer_id" integer NULL, CONSTRAINT "employees_pk" PRIMARY KEY ("id"), CONSTRAINT "employees_employer_fk" FOREIGN KEY ("employer_id") REFERENCES "employees" ("id") ON DELETE CASCADE ON UPDATE CASCADE);
403CREATE TABLE "employees" ("id" serial, "name" text NOT NULL, "employer_id" integer NULL, CONSTRAINT "employees_pk" PRIMARY KEY ("id"), CONSTRAINT "employees_employer_fk" FOREIGN KEY ("employer_id") REFERENCES "employees" ("id") ON DELETE CASCADE ON UPDATE CASCADE);
@@ -546,7 +546,7 @@ newtype AlterTable
546-- definition :: Definition
546-- definition :: Definition
547-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
547-- '["tab" ::: 'Table ('[] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
548-- '["tab" ::: 'Table ('["positive" ::: Check '["col"]] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
548-- '["tab" ::: 'Table ('["positive" ::: Check '["col"]] :=> '["col" ::: 'NoDef :=> 'NotNull 'PGint4])]
549−-- definition = alterTable #tab (addConstraint #positive (check (#col :* Nil) (#col .> 0)))
549+-- definition = alterTable #tab (addConstraint #positive (check #col (#col .> 0)))
550-- in printSQL definition
550-- in printSQL definition
552-- ALTER TABLE "tab" ADD CONSTRAINT "positive" CHECK (("col" > 0));
552-- ALTER TABLE "tab" ADD CONSTRAINT "positive" CHECK (("col" > 0));
@@ -784,7 +784,7 @@ alterType ty = UnsafeAlterColumn $ "TYPE" <+> renderColumnTypeExpression ty
784-- '[ "abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
784-- '[ "abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
785-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]
785-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]
786-- definition =
786-- definition =
787−-- createView #bc (select (#b :* #c :* Nil) (from (table #abc)))
787+-- createView #bc (select (#b :* #c) (from (table #abc)))
788-- in printSQL definition
788-- in printSQL definition
790-- CREATE VIEW "bc" AS SELECT "b" AS "b", "c" AS "c" FROM "abc" AS "abc";
790-- CREATE VIEW "bc" AS SELECT "b" AS "b", "c" AS "c" FROM "abc" AS "abc";