@@ -85,7 +85,7 @@ CREATE statements
86-- | `createTable` adds a table to the schema.
86-- | `createTable` adds a table to the schema.
88−-- >>> :set -XOverloadedLabels -XDataKinds
88+-- >>> :set -XOverloadedLabels
90-- renderDefinition $
90-- renderDefinition $
91-- createTable #tab (int `As` #a :* real `As` #b :* Nil) []
91-- createTable #tab (int `As` #a :* real `As` #b :* Nil) []
@@ -136,7 +136,6 @@ newtype TableConstraint
136-- It allows you to specify that the value in a certain column must satisfy
136-- It allows you to specify that the value in a certain column must satisfy
137-- a Boolean (truth-value) expression.
137-- a Boolean (truth-value) expression.
139−-- >>> :set -XOverloadedLabels -XDataKinds
141-- renderDefinition $
140-- renderDefinition $
142-- createTable #tab
141-- createTable #tab
@@ -154,7 +153,6 @@ check condition = UnsafeTableConstraint $
154-- | `unique` constraints ensure that the data contained in a column,
153-- | `unique` constraints ensure that the data contained in a column,
155-- or a group of columns, is unique among all the rows in the table.
154-- or a group of columns, is unique among all the rows in the table.
157−-- >>> :set -XOverloadedLabels -XDataKinds
159-- renderDefinition $
157-- renderDefinition $
160-- createTable #tab
158-- createTable #tab
@@ -174,7 +172,6 @@ unique columns = UnsafeTableConstraint $
174-- can be used as a unique identifier for rows in the table.
172-- can be used as a unique identifier for rows in the table.
175-- This requires that the values be both unique and not null.
173-- This requires that the values be both unique and not null.
177−-- >>> :set -XOverloadedLabels -XDataKinds
179-- renderDefinition $
176-- renderDefinition $
180-- createTable #tab
177-- createTable #tab
@@ -195,7 +192,6 @@ primaryKey columns = UnsafeTableConstraint $
195-- another table. We say this maintains the referential integrity
192-- another table. We say this maintains the referential integrity
196-- between two related tables.
193-- between two related tables.
198−-- >>> :set -XOverloadedLabels -XDataKinds
201-- definition :: Definition '[]
197-- definition :: Definition '[]
@@ -285,6 +281,10 @@ renderOnUpdate = \case
285DROP statements
281DROP statements
286-----------------------------------------}
282-----------------------------------------}
284+-- | `dropTable` removes a table from the schema.
286+-- >>> renderDefinition $ dropTable #muh_table
287+-- "DROP TABLE muh_table;"
289 :: KnownSymbol table
289 :: KnownSymbol table
290 => Alias table
290 => Alias table
@@ -295,6 +295,7 @@ dropTable table = UnsafeDefinition $ "DROP TABLE" <+> renderAlias table <> ";"
295ALTER statements
295ALTER statements
296-----------------------------------------}
296-----------------------------------------}
298+-- | `alterTable` changes the definition of a table from the schema.
298alterTable
299alterTable
299 :: HasTable table schema columns0
300 :: HasTable table schema columns0
300 => Alias table
301 => Alias table
@@ -306,6 +307,10 @@ alterTable table alteration = UnsafeDefinition $
306 <+> renderAlterTable alteration
307 <+> renderAlterTable alteration
310+-- | `alterTable` changes the name of a table from the schema.
312+-- >>> renderDefinition $ alterTableRename #foo #bar
313+-- "ALTER TABLE foo RENAME TO bar;"
309alterTableRename
314alterTableRename
310 :: (KnownSymbol table0, KnownSymbol table1)
315 :: (KnownSymbol table0, KnownSymbol table1)
311 => Alias table0
316 => Alias table0