Skip to content

Commit

Permalink
Merge pull request #210 from charukiewicz/master
Browse files Browse the repository at this point in the history
Added warning about not using automated migrations in production
  • Loading branch information
snoyberg authored Jun 8, 2018
2 parents 88809d3 + 6df6cba commit 7bdbb4c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion book/asciidoc/persistent.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ declarative syntax. Some other nice features are:
An additional library, link:http://hackage.haskell.org/package/esqueleto[Esqueleto],
builds on top of the Persistent data model, adding type-safe joins and SQL functionality.
* Automatically perform database migrations
* Automatic database migrations in non-production environments to speed up
development.
Persistent works well with Yesod, but it is quite
usable on its own as a standalone library. Most of this chapter will address
Expand Down Expand Up @@ -459,6 +460,12 @@ With this one little code change, Persistent will automatically create your
+Person+ table for you. This split between +runMigration+ and +migrate+ allows
you to migrate multiple tables simultaneously.

NOTE: Using automated database migrations is only recommended in development
environments. Allowing your application to modify your database schema in
a production environment is _very strongly discouraged_. Automated migrations
can be used to help speed up development, but are not a replacement for manual
review and testing that should take place before production deployments.

This works when dealing with just a few entities, but can quickly get tiresome
once we are dealing with a dozen entities. Instead of repeating yourself,
Persistent provides a helper function, +mkMigrate+:
Expand Down

0 comments on commit 7bdbb4c

Please sign in to comment.