on dev help sign in
drop a schema
commitc18a9b2004be10555c201ee95e305f01b7a7e498 authorEitan Chatav <eitan.chatav@gmail.com> dateFri 15 Feb 2019, 23:53 (8 years ago) parent7caa3a2
1 file changed+23−9
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+23−9
squeal-postgresql/src/Squeal/PostgreSQL/Definition.hs+23−9
@@ -37,6 +37,11 @@ module Squeal.PostgreSQL.Definition
3737 , createSchemaIfNotExists
3838 , createTable
3939 , createTableIfNotExists
40+ , createView
41+ , createTypeEnum
42+ , createTypeEnumFrom
43+ , createTypeComposite
44+ , createTypeCompositeFrom
4045 , TableConstraintExpression (..)
4146 , check
4247 , unique
@@ -46,7 +51,10 @@ module Squeal.PostgreSQL.Definition
4651 , OnDeleteClause (..)
4752 , OnUpdateClause (..)
4853 -- ** Drop
54+ , dropSchema
4955 , dropTable
56+ , dropView
57+ , dropType
5058 -- ** Alter
5159 , alterTable
5260 , alterTableRename
@@ -63,15 +71,6 @@ module Squeal.PostgreSQL.Definition
6371 , setNotNull
6472 , dropNotNull
6573 , alterType
66− -- * Views
67− , createView
68− , dropView
69− -- * Types
70− , createTypeEnum
71− , createTypeEnumFrom
72− , createTypeComposite
73− , createTypeCompositeFrom
74− , dropType
7574 -- * Columns
7675 , ColumnTypeExpression (..)
7776 , nullable
@@ -529,6 +528,21 @@ instance RenderSQL OnUpdateClause where
529528{-----------------------------------------
530529DROP statements
531530-----------------------------------------}
531+-- | `dropTable` removes schemas from the database.
532+--
533+-- >>> :{
534+-- let
535+-- definition :: Definition '["muh_schema" ::: schema, "public" ::: public] '["public" ::: public]
536+-- definition = dropSchema #muh_schema
537+-- :}
538+--
539+-- >>> printSQL definition
540+-- DROP SCHEMA "muh_schema";
541+dropSchema
542+ :: Has sch schemas schema
543+ => Alias sch
544+ -> Definition schemas (Drop sch schemas)
545+dropSchema sch = UnsafeDefinition $ "DROP SCHEMA" <+> renderSQL sch
532546
533547-- | `dropTable` removes a table from the schema.
534548--