@@ -26,11 +26,7 @@ import Control.Monad.Trans.Control
2626import Data.Function ((&))
2727import Prelude hiding (id, (.))
2828
29−import Squeal.PostgreSQL.Definition
30−import Squeal.PostgreSQL.Expression
31−import Squeal.PostgreSQL.Manipulation
32−import Squeal.PostgreSQL.PQ
33−import Squeal.PostgreSQL.Schema
29+import Squeal.PostgreSQL
3430import Squeal.PostgreSQL.Transaction
3531
3632data Step io schema0 schema1 = Step
@@ -87,6 +83,13 @@ insertMigration = insertRow_ #schema_migrations
8783deleteMigration :: Manipulation '[MigrationTable] '[ 'NotNull 'PGtext] '[]
8884deleteMigration = deleteFrom_ #schema_migrations (#name .== param @1)
8985
86+selectMigration :: Query '[MigrationTable] '[ 'NotNull 'PGtext]
87+ '["executed_at" ::: 'NotNull 'PGtimestamptz]
88+selectMigration = select
89+ (#executed_at `As` #executed_at :* Nil)
90+ ( from (table (#schema_migrations `As` #m))
91+ & where_ (#name .== param @1))
92+
9093start :: MonadBase IO io => PQ schema schema io ()
9194start = define createMigrations_
9295 & pqThen (begin (TransactionMode RepeatableRead ReadWrite) & void)