alevy / postgresql-orm

An Haskell ORM (Object Relational Mapping) and migrations DSL for PostgreSQL.
http://simple.cx
GNU General Public License v3.0
78 stars 12 forks source link

Implement migration compiler #26

Closed ian-ross closed 6 years ago

ian-ross commented 6 years ago

The idea here is that, instead of running individual migration scripts using runghc, it would be useful to create a single executable ahead of time that knows how to apply all the migrations for a project. This is useful for applications where it's not desirable to have a whole Haskell installation on the machines to which software is deployed. Doing a one-off build of the existing database migrations as part of the software deployment process alleviates this problem.

As well as adding the migration compiler (accessed by running pg_migrate compile), this PR also reorganises things a little to fix some Cabal warnings (in particular, Data and Database are moved into a src directory to ensure that GHC picks up modules from the postgresql-orm package when compiling pg_migrate.hs instead of trying to compile direct from the source for the modules imported by pg_migrate.hs) and fixes a couple of compiler warnings.

ian-ross commented 6 years ago

Huh. Didn't realise you had Travis set up for this. I'll get that working again before this is merged.

ian-ross commented 6 years ago

OK, looks good now. Sorry about that: it was because of the new haskell-src-exts dependency, which needs happy to compile, and more recent versions of GHC need a newer version of happy to be installed.