@@ -63,6 +63,7 @@ module Squeal.PostgreSQL.Definition
63 , dropView
63 , dropView
64 , dropType
64 , dropType
65 , dropIndex
65 , dropIndex
66 -- ** Alter
67 -- ** Alter
67 , alterTable
68 , alterTable
68 , alterTableRename
69 , alterTableRename
@@ -1124,6 +1125,14 @@ createFunction fun arg ret fundef = UnsafeDefinition $
1124 "CREATE" <+> "FUNCTION" <+> renderSQL fun <+> parenthesized (renderSQL arg)
1125 "CREATE" <+> "FUNCTION" <+> renderSQL fun <+> parenthesized (renderSQL arg)
1125 <+> "RETURNS" <+> renderSQL ret <+> renderSQL fundef <> ";"
1126 <+> "RETURNS" <+> renderSQL ret <+> renderSQL fundef <> ";"
1129+ :: (Has sch schemas schema, Has fun schema ('Function arg ret))
1130+ => QualifiedAlias sch fun
1131+ -- ^ name of the user defined function
1132+ -> Definition schemas (Alter sch (Drop ix schema) schemas)
1133+dropFunction fun = UnsafeDefinition $
1134+ "DROP" <+> "Function" <+> renderSQL fun <> ";"
1127newtype FunctionDefinition schemas arg ret = UnsafeFunctionDefinition
1136newtype FunctionDefinition schemas arg ret = UnsafeFunctionDefinition
1128 { renderFunctionDefinition :: ByteString }
1137 { renderFunctionDefinition :: ByteString }
1129 deriving (Eq,Show,GHC.Generic,NFData)
1138 deriving (Eq,Show,GHC.Generic,NFData)
@@ -1136,7 +1145,7 @@ instance RenderSQL (FunctionDefinition schemas arg ret) where
1136dropIndex
1145dropIndex
1137 :: (Has sch schemas schema, Has ix schema 'Index)
1146 :: (Has sch schemas schema, Has ix schema 'Index)
1138 => QualifiedAlias sch ix
1147 => QualifiedAlias sch ix
1139− -- ^ name of the user defined type
1148+ -- ^ name of the user defined index
1140 -> Definition schemas (Alter sch (Drop ix schema) schemas)
1149 -> Definition schemas (Alter sch (Drop ix schema) schemas)
1141dropIndex ix = UnsafeDefinition $ "DROP" <+> "INDEX" <+> renderSQL ix <> ";"
1150dropIndex ix = UnsafeDefinition $ "DROP" <+> "INDEX" <+> renderSQL ix <> ";"