{-# LANGUAGE
AllowAmbiguousTypes
, ConstraintKinds
, DeriveAnyClass
, DeriveGeneric
, DerivingStrategies
, FlexibleContexts
, FlexibleInstances
, GADTs
, LambdaCase
, MultiParamTypeClasses
, OverloadedLabels
, OverloadedStrings
, RankNTypes
, ScopedTypeVariables
, TypeApplications
, TypeInType
, TypeOperators
, UndecidableSuperClasses
#-}
module Squeal.PostgreSQL.Definition.Table
(
createTable
, createTableIfNotExists
, dropTable
, dropTableIfExists
, alterTable
, alterTableIfExists
, alterTableRename
, alterTableIfExistsRename
, alterTableSetSchema
, AlterTable (..)
, addConstraint
, dropConstraint
, AddColumn (..)
, dropColumn
, renameColumn
, alterColumn
, AlterColumn (..)
, setDefault
, dropDefault
, setNotNull
, dropNotNull
, alterType
) where
import Control.DeepSeq
import Data.ByteString
import GHC.TypeLits
import qualified Generics.SOP as SOP
import qualified GHC.Generics as GHC
import Squeal.PostgreSQL.Type.Alias
import Squeal.PostgreSQL.Definition
import Squeal.PostgreSQL.Definition.Constraint
import Squeal.PostgreSQL.Expression
import Squeal.PostgreSQL.Expression.Type
import Squeal.PostgreSQL.Type.List
import Squeal.PostgreSQL.Render
import Squeal.PostgreSQL.Type.Schema
createTable
:: ( KnownSymbol sch
, KnownSymbol tab
, columns ~ (col ': cols)
, SOP.SListI columns
, SOP.SListI constraints
, Has sch db0 schema0
, db1 ~ Alter sch (Create tab ('Table (constraints :=> columns)) schema0) db0 )
=> QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> Definition db0 db1
createTable :: forall (sch :: Symbol) (tab :: Symbol) (columns :: ColumnsType)
(col :: (Symbol, ColumnType)) (cols :: ColumnsType)
(constraints :: TableConstraints)
(db0 :: [(Symbol, [(Symbol, SchemumType)])])
(schema0 :: [(Symbol, SchemumType)])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
(KnownSymbol sch, KnownSymbol tab, columns ~ (col : cols),
SListI columns, SListI constraints, Has sch db0 schema0,
db1
~ Alter
sch (Create tab ('Table (constraints :=> columns)) schema0) db0) =>
QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> Definition db0 db1
createTable QualifiedAlias sch tab
tab NP (Aliased (ColumnTypeExpression db0)) columns
columns NP (Aliased (TableConstraintExpression sch tab db1)) constraints
constraints = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"CREATE TABLE" ByteString -> ByteString -> ByteString
<+> forall (sch :: Symbol) (tab :: Symbol) (columns :: ColumnsType)
(constraints :: TableConstraints)
(db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
(KnownSymbol sch, KnownSymbol tab, SListI columns,
SListI constraints) =>
QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> ByteString
renderCreation QualifiedAlias sch tab
tab NP (Aliased (ColumnTypeExpression db0)) columns
columns NP (Aliased (TableConstraintExpression sch tab db1)) constraints
constraints
createTableIfNotExists
:: ( KnownSymbol sch
, KnownSymbol tab
, columns ~ (col ': cols)
, SOP.SListI columns
, SOP.SListI constraints
, Has sch db0 schema0
, db1 ~ Alter sch (CreateIfNotExists tab ('Table (constraints :=> columns)) schema0) db0 )
=> QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> Definition db0 db1
createTableIfNotExists :: forall (sch :: Symbol) (tab :: Symbol) (columns :: ColumnsType)
(col :: (Symbol, ColumnType)) (cols :: ColumnsType)
(constraints :: TableConstraints)
(db0 :: [(Symbol, [(Symbol, SchemumType)])])
(schema0 :: [(Symbol, SchemumType)])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
(KnownSymbol sch, KnownSymbol tab, columns ~ (col : cols),
SListI columns, SListI constraints, Has sch db0 schema0,
db1
~ Alter
sch
(CreateIfNotExists tab ('Table (constraints :=> columns)) schema0)
db0) =>
QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> Definition db0 db1
createTableIfNotExists QualifiedAlias sch tab
tab NP (Aliased (ColumnTypeExpression db0)) columns
columns NP (Aliased (TableConstraintExpression sch tab db1)) constraints
constraints = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"CREATE TABLE IF NOT EXISTS"
ByteString -> ByteString -> ByteString
<+> forall (sch :: Symbol) (tab :: Symbol) (columns :: ColumnsType)
(constraints :: TableConstraints)
(db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
(KnownSymbol sch, KnownSymbol tab, SListI columns,
SListI constraints) =>
QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> ByteString
renderCreation QualifiedAlias sch tab
tab NP (Aliased (ColumnTypeExpression db0)) columns
columns NP (Aliased (TableConstraintExpression sch tab db1)) constraints
constraints
renderCreation
:: ( KnownSymbol sch
, KnownSymbol tab
, SOP.SListI columns
, SOP.SListI constraints )
=> QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> ByteString
renderCreation :: forall (sch :: Symbol) (tab :: Symbol) (columns :: ColumnsType)
(constraints :: TableConstraints)
(db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
(KnownSymbol sch, KnownSymbol tab, SListI columns,
SListI constraints) =>
QualifiedAlias sch tab
-> NP (Aliased (ColumnTypeExpression db0)) columns
-> NP (Aliased (TableConstraintExpression sch tab db1)) constraints
-> ByteString
renderCreation QualifiedAlias sch tab
tab NP (Aliased (ColumnTypeExpression db0)) columns
columns NP (Aliased (TableConstraintExpression sch tab db1)) constraints
constraints = forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch tab
tab
ByteString -> ByteString -> ByteString
<+> ByteString -> ByteString
parenthesized
( forall {k} (xs :: [k]) (expression :: k -> *).
SListI xs =>
(forall (x :: k). expression x -> ByteString)
-> NP expression xs -> ByteString
renderCommaSeparated forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(x :: (Symbol, ColumnType)).
Aliased (ColumnTypeExpression db) x -> ByteString
renderColumnDef NP (Aliased (ColumnTypeExpression db0)) columns
columns
forall a. Semigroup a => a -> a -> a
<> ( case NP (Aliased (TableConstraintExpression sch tab db1)) constraints
constraints of
NP (Aliased (TableConstraintExpression sch tab db1)) constraints
Nil -> ByteString
""
NP (Aliased (TableConstraintExpression sch tab db1)) constraints
_ -> ByteString
", " forall a. Semigroup a => a -> a -> a
<>
forall {k} (xs :: [k]) (expression :: k -> *).
SListI xs =>
(forall (x :: k). expression x -> ByteString)
-> NP expression xs -> ByteString
renderCommaSeparated forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])])
(constraint :: (Symbol, TableConstraint)).
Aliased (TableConstraintExpression sch tab db) constraint
-> ByteString
renderConstraint NP (Aliased (TableConstraintExpression sch tab db1)) constraints
constraints ) )
forall a. Semigroup a => a -> a -> a
<> ByteString
";"
where
renderColumnDef :: Aliased (ColumnTypeExpression db) x -> ByteString
renderColumnDef :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(x :: (Symbol, ColumnType)).
Aliased (ColumnTypeExpression db) x -> ByteString
renderColumnDef (ColumnTypeExpression db ty
ty `As` Alias alias
column) =
forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias alias
column ByteString -> ByteString -> ByteString
<+> forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty :: ColumnType).
ColumnTypeExpression db ty -> ByteString
renderColumnTypeExpression ColumnTypeExpression db ty
ty
renderConstraint
:: Aliased (TableConstraintExpression sch tab db) constraint
-> ByteString
renderConstraint :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])])
(constraint :: (Symbol, TableConstraint)).
Aliased (TableConstraintExpression sch tab db) constraint
-> ByteString
renderConstraint (TableConstraintExpression sch tab db ty
constraint `As` Alias alias
alias) =
ByteString
"CONSTRAINT" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias alias
alias ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL TableConstraintExpression sch tab db ty
constraint
dropTable
:: ( Has sch db schema
, KnownSymbol tab )
=> QualifiedAlias sch tab
-> Definition db (Alter sch (DropSchemum tab 'Table schema) db)
dropTable :: forall (sch :: Symbol) (db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol).
(Has sch db schema, KnownSymbol tab) =>
QualifiedAlias sch tab
-> Definition db (Alter sch (DropSchemum tab 'Table schema) db)
dropTable QualifiedAlias sch tab
tab = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$ ByteString
"DROP TABLE" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch tab
tab forall a. Semigroup a => a -> a -> a
<> ByteString
";"
dropTableIfExists
:: ( Has sch db schema
, KnownSymbol tab)
=> QualifiedAlias sch tab
-> Definition db (Alter sch (DropSchemumIfExists tab 'Table schema) db)
dropTableIfExists :: forall (sch :: Symbol) (db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol).
(Has sch db schema, KnownSymbol tab) =>
QualifiedAlias sch tab
-> Definition
db (Alter sch (DropSchemumIfExists tab 'Table schema) db)
dropTableIfExists QualifiedAlias sch tab
tab = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"DROP TABLE IF EXISTS" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch tab
tab forall a. Semigroup a => a -> a -> a
<> ByteString
";"
alterTable
:: (Has sch db schema, KnownSymbol tab)
=> QualifiedAlias sch tab
-> AlterTable sch tab db table
-> Definition db (Alter sch (Alter tab ('Table table) schema) db)
alterTable :: forall (sch :: Symbol) (db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol)
(table :: TableType).
(Has sch db schema, KnownSymbol tab) =>
QualifiedAlias sch tab
-> AlterTable sch tab db table
-> Definition db (Alter sch (Alter tab ('Table table) schema) db)
alterTable QualifiedAlias sch tab
tab AlterTable sch tab db table
alteration = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"ALTER TABLE"
ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch tab
tab
ByteString -> ByteString -> ByteString
<+> forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> ByteString
renderAlterTable AlterTable sch tab db table
alteration
forall a. Semigroup a => a -> a -> a
<> ByteString
";"
alterTableIfExists
:: (Has sch db schema, KnownSymbol tab)
=> QualifiedAlias sch tab
-> AlterTable sch tab db table
-> Definition db (Alter sch (AlterIfExists tab ('Table table) schema) db)
alterTableIfExists :: forall (sch :: Symbol) (db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol)
(table :: TableType).
(Has sch db schema, KnownSymbol tab) =>
QualifiedAlias sch tab
-> AlterTable sch tab db table
-> Definition
db (Alter sch (AlterIfExists tab ('Table table) schema) db)
alterTableIfExists QualifiedAlias sch tab
tab AlterTable sch tab db table
alteration = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"ALTER TABLE IF EXISTS"
ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch tab
tab
ByteString -> ByteString -> ByteString
<+> forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> ByteString
renderAlterTable AlterTable sch tab db table
alteration
forall a. Semigroup a => a -> a -> a
<> ByteString
";"
alterTableRename
:: ( Has sch db schema
, KnownSymbol tab1
, Has tab0 schema ('Table table))
=> QualifiedAlias sch tab0
-> Alias tab1
-> Definition db (Alter sch (Rename tab0 tab1 schema) db )
alterTableRename :: forall (sch :: Symbol) (db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab1 :: Symbol)
(tab0 :: Symbol) (table :: TableType).
(Has sch db schema, KnownSymbol tab1,
Has tab0 schema ('Table table)) =>
QualifiedAlias sch tab0
-> Alias tab1
-> Definition db (Alter sch (Rename tab0 tab1 schema) db)
alterTableRename QualifiedAlias sch tab0
tab0 Alias tab1
tab1 = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"ALTER TABLE" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch tab0
tab0
ByteString -> ByteString -> ByteString
<+> ByteString
"RENAME TO" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias tab1
tab1 forall a. Semigroup a => a -> a -> a
<> ByteString
";"
alterTableIfExistsRename
:: ( Has sch db schema
, KnownSymbol tab0
, KnownSymbol tab1 )
=> QualifiedAlias sch tab0
-> Alias tab1
-> Definition db (Alter sch (RenameIfExists tab0 tab1 schema) db )
alterTableIfExistsRename :: forall (sch :: Symbol) (db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab0 :: Symbol)
(tab1 :: Symbol).
(Has sch db schema, KnownSymbol tab0, KnownSymbol tab1) =>
QualifiedAlias sch tab0
-> Alias tab1
-> Definition db (Alter sch (RenameIfExists tab0 tab1 schema) db)
alterTableIfExistsRename QualifiedAlias sch tab0
tab0 Alias tab1
tab1 = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"ALTER TABLE IF EXISTS" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch tab0
tab0
ByteString -> ByteString -> ByteString
<+> ByteString
"RENAME TO" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias tab1
tab1 forall a. Semigroup a => a -> a -> a
<> ByteString
";"
alterTableSetSchema
:: ( Has sch0 db schema0
, Has tab schema0 ('Table table)
, Has sch1 db schema1 )
=> QualifiedAlias sch0 tab
-> Alias sch1
-> Definition db (SetSchema sch0 sch1 schema0 schema1 tab 'Table table db)
alterTableSetSchema :: forall (sch0 :: Symbol) (db :: [(Symbol, [(Symbol, SchemumType)])])
(schema0 :: [(Symbol, SchemumType)]) (tab :: Symbol)
(table :: TableType) (sch1 :: Symbol)
(schema1 :: [(Symbol, SchemumType)]).
(Has sch0 db schema0, Has tab schema0 ('Table table),
Has sch1 db schema1) =>
QualifiedAlias sch0 tab
-> Alias sch1
-> Definition
db (SetSchema sch0 sch1 schema0 schema1 tab 'Table table db)
alterTableSetSchema QualifiedAlias sch0 tab
tab Alias sch1
sch = forall (db0 :: [(Symbol, [(Symbol, SchemumType)])])
(db1 :: [(Symbol, [(Symbol, SchemumType)])]).
ByteString -> Definition db0 db1
UnsafeDefinition forall a b. (a -> b) -> a -> b
$
ByteString
"ALTER TABLE" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL QualifiedAlias sch0 tab
tab ByteString -> ByteString -> ByteString
<+> ByteString
"SET SCHEMA" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias sch1
sch forall a. Semigroup a => a -> a -> a
<> ByteString
";"
newtype AlterTable
(sch :: Symbol)
(tab :: Symbol)
(db :: SchemasType)
(table :: TableType) =
UnsafeAlterTable {forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> ByteString
renderAlterTable :: ByteString}
deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType) x.
Rep (AlterTable sch tab db table) x -> AlterTable sch tab db table
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType) x.
AlterTable sch tab db table -> Rep (AlterTable sch tab db table) x
$cto :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType) x.
Rep (AlterTable sch tab db table) x -> AlterTable sch tab db table
$cfrom :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType) x.
AlterTable sch tab db table -> Rep (AlterTable sch tab db table) x
GHC.Generic,Int -> AlterTable sch tab db table -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
Int -> AlterTable sch tab db table -> ShowS
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
[AlterTable sch tab db table] -> ShowS
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> String
showList :: [AlterTable sch tab db table] -> ShowS
$cshowList :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
[AlterTable sch tab db table] -> ShowS
show :: AlterTable sch tab db table -> String
$cshow :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> String
showsPrec :: Int -> AlterTable sch tab db table -> ShowS
$cshowsPrec :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
Int -> AlterTable sch tab db table -> ShowS
Show,AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
/= :: AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
$c/= :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
== :: AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
$c== :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
Eq,AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
AlterTable sch tab db table
-> AlterTable sch tab db table -> Ordering
AlterTable sch tab db table
-> AlterTable sch tab db table -> AlterTable sch tab db table
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
Eq (AlterTable sch tab db table)
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table
-> AlterTable sch tab db table -> Ordering
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table
-> AlterTable sch tab db table -> AlterTable sch tab db table
min :: AlterTable sch tab db table
-> AlterTable sch tab db table -> AlterTable sch tab db table
$cmin :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table
-> AlterTable sch tab db table -> AlterTable sch tab db table
max :: AlterTable sch tab db table
-> AlterTable sch tab db table -> AlterTable sch tab db table
$cmax :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table
-> AlterTable sch tab db table -> AlterTable sch tab db table
>= :: AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
$c>= :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
> :: AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
$c> :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
<= :: AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
$c<= :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
< :: AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
$c< :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> AlterTable sch tab db table -> Bool
compare :: AlterTable sch tab db table
-> AlterTable sch tab db table -> Ordering
$ccompare :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table
-> AlterTable sch tab db table -> Ordering
Ord,forall a. (a -> ()) -> NFData a
forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> ()
rnf :: AlterTable sch tab db table -> ()
$crnf :: forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
AlterTable sch tab db table -> ()
NFData)
addConstraint
:: ( KnownSymbol alias
, Has sch db schema
, Has tab schema ('Table (constraints :=> columns)) )
=> Alias alias
-> TableConstraintExpression sch tab db constraint
-> AlterTable sch tab db (Create alias constraint constraints :=> columns)
addConstraint :: forall (alias :: Symbol) (sch :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol)
(constraints :: TableConstraints) (columns :: ColumnsType)
(constraint :: TableConstraint).
(KnownSymbol alias, Has sch db schema,
Has tab schema ('Table (constraints :=> columns))) =>
Alias alias
-> TableConstraintExpression sch tab db constraint
-> AlterTable
sch tab db (Create alias constraint constraints :=> columns)
addConstraint Alias alias
alias TableConstraintExpression sch tab db constraint
constraint = forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
ByteString -> AlterTable sch tab db table
UnsafeAlterTable forall a b. (a -> b) -> a -> b
$
ByteString
"ADD" ByteString -> ByteString -> ByteString
<+> ByteString
"CONSTRAINT" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias alias
alias
ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL TableConstraintExpression sch tab db constraint
constraint
dropConstraint
:: ( KnownSymbol constraint
, Has sch db schema
, Has tab schema ('Table (constraints :=> columns)) )
=> Alias constraint
-> AlterTable sch tab db (Drop constraint constraints :=> columns)
dropConstraint :: forall (constraint :: Symbol) (sch :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol)
(constraints :: TableConstraints) (columns :: ColumnsType).
(KnownSymbol constraint, Has sch db schema,
Has tab schema ('Table (constraints :=> columns))) =>
Alias constraint
-> AlterTable sch tab db (Drop constraint constraints :=> columns)
dropConstraint Alias constraint
constraint = forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
ByteString -> AlterTable sch tab db table
UnsafeAlterTable forall a b. (a -> b) -> a -> b
$
ByteString
"DROP" ByteString -> ByteString -> ByteString
<+> ByteString
"CONSTRAINT" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias constraint
constraint
class AddColumn ty where
addColumn
:: ( KnownSymbol column
, Has sch db schema
, Has tab schema ('Table (constraints :=> columns)) )
=> Alias column
-> ColumnTypeExpression db ty
-> AlterTable sch tab db (constraints :=> Create column ty columns)
addColumn Alias column
column ColumnTypeExpression db ty
ty = forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
ByteString -> AlterTable sch tab db table
UnsafeAlterTable forall a b. (a -> b) -> a -> b
$
ByteString
"ADD COLUMN" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias column
column ByteString -> ByteString -> ByteString
<+> forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty :: ColumnType).
ColumnTypeExpression db ty -> ByteString
renderColumnTypeExpression ColumnTypeExpression db ty
ty
instance {-# OVERLAPPING #-} AddColumn ('Def :=> ty)
instance {-# OVERLAPPABLE #-} AddColumn ('NoDef :=> 'Null ty)
dropColumn
:: ( KnownSymbol column
, Has sch db schema
, Has tab schema ('Table (constraints :=> columns)) )
=> Alias column
-> AlterTable sch tab db (constraints :=> Drop column columns)
dropColumn :: forall (column :: Symbol) (sch :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol)
(constraints :: TableConstraints) (columns :: ColumnsType).
(KnownSymbol column, Has sch db schema,
Has tab schema ('Table (constraints :=> columns))) =>
Alias column
-> AlterTable sch tab db (constraints :=> Drop column columns)
dropColumn Alias column
column = forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
ByteString -> AlterTable sch tab db table
UnsafeAlterTable forall a b. (a -> b) -> a -> b
$
ByteString
"DROP COLUMN" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias column
column
renameColumn
:: ( KnownSymbol column0
, KnownSymbol column1
, Has sch db schema
, Has tab schema ('Table (constraints :=> columns)) )
=> Alias column0
-> Alias column1
-> AlterTable sch tab db (constraints :=> Rename column0 column1 columns)
renameColumn :: forall (column0 :: Symbol) (column1 :: Symbol) (sch :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol)
(constraints :: TableConstraints) (columns :: ColumnsType).
(KnownSymbol column0, KnownSymbol column1, Has sch db schema,
Has tab schema ('Table (constraints :=> columns))) =>
Alias column0
-> Alias column1
-> AlterTable
sch tab db (constraints :=> Rename column0 column1 columns)
renameColumn Alias column0
column0 Alias column1
column1 = forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
ByteString -> AlterTable sch tab db table
UnsafeAlterTable forall a b. (a -> b) -> a -> b
$
ByteString
"RENAME COLUMN" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias column0
column0 ByteString -> ByteString -> ByteString
<+> ByteString
"TO" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias column1
column1
alterColumn
:: ( KnownSymbol column
, Has sch db schema
, Has tab schema ('Table (constraints :=> columns))
, Has column columns ty0 )
=> Alias column
-> AlterColumn db ty0 ty1
-> AlterTable sch tab db (constraints :=> Alter column ty1 columns)
alterColumn :: forall (column :: Symbol) (sch :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])])
(schema :: [(Symbol, SchemumType)]) (tab :: Symbol)
(constraints :: TableConstraints) (columns :: ColumnsType)
(ty0 :: ColumnType) (ty1 :: ColumnType).
(KnownSymbol column, Has sch db schema,
Has tab schema ('Table (constraints :=> columns)),
Has column columns ty0) =>
Alias column
-> AlterColumn db ty0 ty1
-> AlterTable sch tab db (constraints :=> Alter column ty1 columns)
alterColumn Alias column
column AlterColumn db ty0 ty1
alteration = forall (sch :: Symbol) (tab :: Symbol)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (table :: TableType).
ByteString -> AlterTable sch tab db table
UnsafeAlterTable forall a b. (a -> b) -> a -> b
$
ByteString
"ALTER COLUMN" ByteString -> ByteString -> ByteString
<+> forall sql. RenderSQL sql => sql -> ByteString
renderSQL Alias column
column ByteString -> ByteString -> ByteString
<+> forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> ByteString
renderAlterColumn AlterColumn db ty0 ty1
alteration
newtype AlterColumn (db :: SchemasType) (ty0 :: ColumnType) (ty1 :: ColumnType) =
UnsafeAlterColumn {forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> ByteString
renderAlterColumn :: ByteString}
deriving (forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType) x.
Rep (AlterColumn db ty0 ty1) x -> AlterColumn db ty0 ty1
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType) x.
AlterColumn db ty0 ty1 -> Rep (AlterColumn db ty0 ty1) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType) x.
Rep (AlterColumn db ty0 ty1) x -> AlterColumn db ty0 ty1
$cfrom :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType) x.
AlterColumn db ty0 ty1 -> Rep (AlterColumn db ty0 ty1) x
GHC.Generic,Int -> AlterColumn db ty0 ty1 -> ShowS
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
Int -> AlterColumn db ty0 ty1 -> ShowS
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
[AlterColumn db ty0 ty1] -> ShowS
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AlterColumn db ty0 ty1] -> ShowS
$cshowList :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
[AlterColumn db ty0 ty1] -> ShowS
show :: AlterColumn db ty0 ty1 -> String
$cshow :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> String
showsPrec :: Int -> AlterColumn db ty0 ty1 -> ShowS
$cshowsPrec :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
Int -> AlterColumn db ty0 ty1 -> ShowS
Show,AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
$c/= :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
== :: AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
$c== :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
Eq,AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Ordering
AlterColumn db ty0 ty1
-> AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
Eq (AlterColumn db ty0 ty1)
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Ordering
forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1
-> AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: AlterColumn db ty0 ty1
-> AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1
$cmin :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1
-> AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1
max :: AlterColumn db ty0 ty1
-> AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1
$cmax :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1
-> AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1
>= :: AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
$c>= :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
> :: AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
$c> :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
<= :: AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
$c<= :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
< :: AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
$c< :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Bool
compare :: AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Ordering
$ccompare :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> AlterColumn db ty0 ty1 -> Ordering
Ord,forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> ()
forall a. (a -> ()) -> NFData a
rnf :: AlterColumn db ty0 ty1 -> ()
$crnf :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
AlterColumn db ty0 ty1 -> ()
NFData)
setDefault
:: Expression 'Ungrouped '[] '[] db '[] '[] ty
-> AlterColumn db (constraint :=> ty) ('Def :=> ty)
setDefault :: forall (db :: [(Symbol, [(Symbol, SchemumType)])]) (ty :: NullType)
(constraint :: Optionality).
Expression 'Ungrouped '[] '[] db '[] '[] ty
-> AlterColumn db (constraint :=> ty) ('Def :=> ty)
setDefault Expression 'Ungrouped '[] '[] db '[] '[] ty
expression = forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
ByteString -> AlterColumn db ty0 ty1
UnsafeAlterColumn forall a b. (a -> b) -> a -> b
$
ByteString
"SET DEFAULT" ByteString -> ByteString -> ByteString
<+> forall (grp :: Grouping) (lat :: FromType) (with :: FromType)
(db :: [(Symbol, [(Symbol, SchemumType)])]) (params :: [NullType])
(from :: FromType) (ty :: NullType).
Expression grp lat with db params from ty -> ByteString
renderExpression Expression 'Ungrouped '[] '[] db '[] '[] ty
expression
dropDefault :: AlterColumn db ('Def :=> ty) ('NoDef :=> ty)
dropDefault :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty :: NullType).
AlterColumn db ('Def :=> ty) ('NoDef :=> ty)
dropDefault = forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
ByteString -> AlterColumn db ty0 ty1
UnsafeAlterColumn forall a b. (a -> b) -> a -> b
$ ByteString
"DROP DEFAULT"
setNotNull
:: AlterColumn db (constraint :=> 'Null ty) (constraint :=> 'NotNull ty)
setNotNull :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(constraint :: Optionality) (ty :: PGType).
AlterColumn
db (constraint :=> 'Null ty) (constraint :=> 'NotNull ty)
setNotNull = forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
ByteString -> AlterColumn db ty0 ty1
UnsafeAlterColumn forall a b. (a -> b) -> a -> b
$ ByteString
"SET NOT NULL"
dropNotNull
:: AlterColumn db (constraint :=> 'NotNull ty) (constraint :=> 'Null ty)
dropNotNull :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(constraint :: Optionality) (ty :: PGType).
AlterColumn
db (constraint :=> 'NotNull ty) (constraint :=> 'Null ty)
dropNotNull = forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
ByteString -> AlterColumn db ty0 ty1
UnsafeAlterColumn forall a b. (a -> b) -> a -> b
$ ByteString
"DROP NOT NULL"
alterType :: ColumnTypeExpression db ty -> AlterColumn db ty0 ty
alterType :: forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty :: ColumnType) (ty0 :: ColumnType).
ColumnTypeExpression db ty -> AlterColumn db ty0 ty
alterType ColumnTypeExpression db ty
ty = forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty0 :: ColumnType) (ty1 :: ColumnType).
ByteString -> AlterColumn db ty0 ty1
UnsafeAlterColumn forall a b. (a -> b) -> a -> b
$ ByteString
"TYPE" ByteString -> ByteString -> ByteString
<+> forall (db :: [(Symbol, [(Symbol, SchemumType)])])
(ty :: ColumnType).
ColumnTypeExpression db ty -> ByteString
renderColumnTypeExpression ColumnTypeExpression db ty
ty