{-# LANGUAGE CPP #-}
module Database.PostgreSQL.PQTypes.Model.Migration (
DropTableMode(..),
MigrationAction(..),
Migration(..),
isStandardMigration, isDropTableMigration
) where
import Data.Int
import Database.PostgreSQL.PQTypes.Model.Index
import Database.PostgreSQL.PQTypes.Model.Table
import Database.PostgreSQL.PQTypes.SQL.Raw
data MigrationAction m =
StandardMigration (m ())
| DropTableMigration DropTableMode
| CreateIndexConcurrentlyMigration
(RawSQL ())
TableIndex
| DropIndexConcurrentlyMigration
(RawSQL ())
TableIndex
data Migration m =
Migration {
Migration m -> RawSQL ()
mgrTableName :: RawSQL ()
, Migration m -> Int32
mgrFrom :: Int32
, Migration m -> MigrationAction m
mgrAction :: MigrationAction m
}
isStandardMigration :: Migration m -> Bool
isStandardMigration :: Migration m -> Bool
isStandardMigration Migration{Int32
RawSQL ()
MigrationAction m
mgrAction :: MigrationAction m
mgrFrom :: Int32
mgrTableName :: RawSQL ()
mgrAction :: forall (m :: * -> *). Migration m -> MigrationAction m
mgrFrom :: forall (m :: * -> *). Migration m -> Int32
mgrTableName :: forall (m :: * -> *). Migration m -> RawSQL ()
..} =
case MigrationAction m
mgrAction of
StandardMigration{} -> Bool
True
DropTableMigration{} -> Bool
False
CreateIndexConcurrentlyMigration{} -> Bool
False
DropIndexConcurrentlyMigration{} -> Bool
False
isDropTableMigration :: Migration m -> Bool
isDropTableMigration :: Migration m -> Bool
isDropTableMigration Migration{Int32
RawSQL ()
MigrationAction m
mgrAction :: MigrationAction m
mgrFrom :: Int32
mgrTableName :: RawSQL ()
mgrAction :: forall (m :: * -> *). Migration m -> MigrationAction m
mgrFrom :: forall (m :: * -> *). Migration m -> Int32
mgrTableName :: forall (m :: * -> *). Migration m -> RawSQL ()
..} =
case MigrationAction m
mgrAction of
StandardMigration{} -> Bool
False
DropTableMigration{} -> Bool
True
CreateIndexConcurrentlyMigration{} -> Bool
False
DropIndexConcurrentlyMigration{} -> Bool
False