@@ -827,24 +827,24 @@ dropNotNull = UnsafeAlterColumn $ "DROP NOT NULL"
827alterType :: ColumnTypeExpression db ty -> AlterColumn db ty0 ty
827alterType :: ColumnTypeExpression db ty -> AlterColumn db ty0 ty
828alterType ty = UnsafeAlterColumn $ "TYPE" <+> renderColumnTypeExpression ty
828alterType ty = UnsafeAlterColumn $ "TYPE" <+> renderColumnTypeExpression ty
830−-- | Create a view.
830+{- | Create a view.
831−--
831+>>> type ABC = '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4]
832+>>> type BC = '["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4]
834−-- definition :: Definition
835+ definition :: Definition
835−-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])]]
836+ '[ "public" ::: '["abc" ::: 'Table ('[] :=> ABC)]]
836−-- '[ "public" ::: '["abc" ::: 'Table ('[] :=> '["a" ::: 'NoDef :=> 'Null 'PGint4, "b" ::: 'NoDef :=> 'Null 'PGint4, "c" ::: 'NoDef :=> 'Null 'PGint4])
837+ '[ "public" ::: '["abc" ::: 'Table ('[] :=> ABC), "bc" ::: 'View BC]]
837−-- , "bc" ::: 'View ('["b" ::: 'Null 'PGint4, "c" ::: 'Null 'PGint4])]]
838−-- definition =
838+ definition =
839−-- createView #bc (select (#b :* #c) (from (table #abc)))
839+ createView #bc (select (#b :* #c) (from (table #abc)))
840−-- in printSQL definition
840+in printSQL definition
842−-- CREATE VIEW "bc" AS SELECT "b" AS "b", "c" AS "c" FROM "abc" AS "abc";
842+CREATE VIEW "bc" AS SELECT "b" AS "b", "c" AS "c" FROM "abc" AS "abc";
843createView
844createView
844 :: (KnownSymbol sch, KnownSymbol vw, Has sch db schema)
845 :: (KnownSymbol sch, KnownSymbol vw, Has sch db schema)
845 => QualifiedAlias sch vw -- ^ the name of the view to add
846 => QualifiedAlias sch vw -- ^ the name of the view to add
846− -> Query db '[] view
847+ -> Query db '[] view -- ^ query
848 -> Definition db (Alter sch (Create vw ('View view) schema) db)
848 -> Definition db (Alter sch (Create vw ('View view) schema) db)
849createView alias query = UnsafeDefinition $
849createView alias query = UnsafeDefinition $
850 "CREATE" <+> "VIEW" <+> renderQualifiedAlias alias <+> "AS"
850 "CREATE" <+> "VIEW" <+> renderQualifiedAlias alias <+> "AS"