Commit 39bf4d38 authored by Sophie Herold's avatar Sophie Herold 🌼

Fixes type upgrade

parent 6cae4e19
......@@ -125,6 +125,7 @@ readSchema opts md = do
errorCheck ("module dir does not exist: " <> tshow md)
schemaData <- readObjectFromFile opts schemaConfig
domains <- confDirFiles "domains.d" >>= mapM (readObjectFromFile opts)
types <- confDirFiles "types.d" >>= mapM (readObjectFromFile opts)
sequences <- confDirFiles "sequences.d" >>= mapM (readObjectFromFile opts)
tables <- confDirFiles "tables.d" >>= mapM (readObjectFromFile opts)
functions <-
......@@ -133,6 +134,7 @@ readSchema opts md = do
let schemaData' =
schemaData
{ schemaDomains = schemaDomains schemaData <> Just domains
, schemaTypes = schemaTypes schemaData <> Just types
, schemaSequences = schemaSequences schemaData <> Just sequences
, schemaTables = schemaTables schemaData <> Just tables
, schemaFunctions = schemaFunctions schemaData <> Just functions
......
......@@ -70,11 +70,11 @@ module Database.HamSql.Internal.PostgresCon where
import Control.Exception
import Control.Monad
import qualified Data.ByteString.Char8 as B
import Data.Function
import Data.Maybe
import Data.Set (fromList, notMember)
import Database.PostgreSQL.Simple
import Database.PostgreSQL.Simple.Transaction
import Network.URI (URI)
import Database.HamSql.Internal.DbUtils
......@@ -87,6 +87,7 @@ import Database.HamSql.Internal.Stmt.Function
import Database.HamSql.Internal.Stmt.Role
import Database.HamSql.Internal.Stmt.Sequence
import Database.HamSql.Internal.Stmt.Table
import Database.HamSql.Internal.Stmt.Type
import Database.HamSql.Internal.Utils
import Database.HamSql.Setup
import Database.YamSql
......@@ -109,11 +110,12 @@ pgsqlDeleteAllStmt conn = do
pgsqlUpdateFragile :: Setup -> Connection -> [SqlStmt] -> IO [SqlStmt]
pgsqlUpdateFragile setup conn stmts =
correctStmts SqlCreateDomain deployedDomainIds stmtsDropDomain stmts >>=
correctStmts SqlCreateTable deployedTableIds stmtsDropTable >>=
correctStmts SqlAddColumn deployedTableColumnIds stmtsDropTableColumn >>=
correctStmts SqlCreateSequence deployedSequenceIds stmtsDropSequence >>=
stmts & correctStmts SqlAddColumn deployedTableColumnIds stmtsDropTableColumn >>=
correctStmts SqlCreateDomain deployedDomainIds stmtsDropDomain >>=
correctStmts SqlCreateRole (deployedRoleIds setup) (stmtsDropRole setup) >>=
correctStmts SqlCreateSequence deployedSequenceIds stmtsDropSequence >>=
correctStmts SqlCreateTable deployedTableIds stmtsDropTable >>=
correctStmts SqlCreateType deployedTypeIds stmtsDropType >>=
correctStmts
SqlGrantMembership
(deployedRoleMemberIds setup)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment