@@ -33,6 +33,8 @@ module Squeal.PostgreSQL.Definition
34 -- * Tables
34 -- * Tables
35 -- ** Create
35 -- ** Create
37+ , createSchemaIfNotExists
36 , createTable
38 , createTable
37 , createTableIfNotExists
39 , createTableIfNotExists
38 , TableConstraintExpression (..)
40 , TableConstraintExpression (..)
@@ -125,6 +127,21 @@ instance Category Definition where
125CREATE statements
127CREATE statements
126-----------------------------------------}
128-----------------------------------------}
133+ -> Definition db (Create sch '[] db)
134+createSchema sch = UnsafeDefinition $
135+ "CREATE" <+> "SCHEMA" <+> renderAlias sch <> ";"
137+createSchemaIfNotExists
138+ :: (KnownSymbol sch, Has sch db schema)
141+createSchemaIfNotExists sch = UnsafeDefinition $
142+ "CREATE" <+> "SCHEMA" <+> "IF" <+> "NOT" <+> "EXISTS"
143+ <+> renderAlias sch <> ";"
128{- | `createTable` adds a table to the schema.
145{- | `createTable` adds a table to the schema.
130>>> :set -XOverloadedLabels
147>>> :set -XOverloadedLabels