Skip to content

Commit

Permalink
migration example safety check
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbecich committed Dec 23, 2024
1 parent 867fc8a commit bcdb53e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions beam-postgres/examples/app/RunMigration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@ connInfo = ConnectInfo "localhost" (read "5432") "postgres" "foo" "postgres"

main :: IO ()
main = do
putStrLn "Running migration..."
c <- connect connInfo
putStrLn "Pagila migration"

_ <- migrateDB c
putStrLn "**This will overwrite data in your Postgres instance**"
putStrLn "Type 'migrate' to proceed."
x <- getLine

close c
if x == "migrate" then do
putStrLn "Running migration..."
c <- connect connInfo

_ <- migrateDB c

close c
else do
putStrLn "Input was not 'migrate'; quitting"

0 comments on commit bcdb53e

Please sign in to comment.