Drifter migration backend for the amazing Project: M36 database.
This package is maintained by Grafted-In.
import qualified Data.Map.Strict as Map
import Data.Text (Text)
import Drifter.ProjectM36
import Drifter.ProjectM36.RelSchema
import ProjectM36.Atomable (toAtomType)
import ProjectM36.Client.Simple
main :: IO ()
main = do
dbConn <- ... -- use ProjectM36.Client.Simple
runMigrations dbConn schemaChanges
schemaChanges :: [Change PM36Migration]
schemaChanges = [
Change{
changeName = ChangeName "make-relvar-purchases",
changeDescription = Nothing,
changeDependencies = [],
changeMethod = MigrationStep (
defineRelSchema $ RelSchema "purchases" $ Map.fromList [
("purchaseUuid", (TextAtomType, Unique)),
("purchasePersonName", (TextAtomType, NonUnique)),
("purchasePersonEmail", (TextAtomType, NonUnique)),
("purchaseStates", (toAtomType $ undefined @[Text], NonUnique)),
("purchasePriceCents", (IntAtomType, NonUnique)),
("purchaseDownloads", (IntAtomType, NonUnique)),
("purchaseTimestamp", (DateTimeAtomType, NonUnique))
]
)
}
]