The hasql-migration package

[ Tags: bsd3, database, library ] [ Propose Tags ]

A PostgreSQL-simple schema migration utility


[Skip to Readme]

Properties

Versions 0.1.0, 0.1.1, 0.1.2, 0.1.3
Dependencies base (>=4.7 && <5), base64-bytestring (>=1.0), bytestring (>=0.10), contravariant (>=1.3), cryptohash (>=0.11), data-default-class (>=0.0.1), directory (>=1.2), hasql (>=0.19), hasql-transaction (>=0.5), text (>=1.2), time (>=1.4) [details]
License BSD3
Copyright Timo von Holtz, Andreas Meingast
Author Timo von Holtz <tvh@tvholtz.de>
Maintainer Timo von Holtz <tvh@tvholtz.de>
Category Database
Home page https://github.com/tvh/hasql-migration
Bug tracker https://github.com/tvh/hasql-migration/issues
Source repository head: git clone git://github.com/tvh/hasql-migration
Uploaded Tue Jan 17 18:04:17 UTC 2017 by TvH
Updated Tue Jan 24 20:36:33 UTC 2017 by TvH to revision 1   [What is this?]
Distributions LTSHaskell:0.1.3, NixOS:0.1.3, Stackage:0.1.3, Tumbleweed:0.1.3
Downloads 400 total (154 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-01-17 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees


Readme for hasql-migration-0.1.3

[back to package description]

PostgreSQL Migrations for Haskell

Build Status

Welcome to hasql-migrations, a tool for helping you with PostgreSQL schema migrations. This is a port of postgresql-simple-migration for use with hasql.

Why?

Database migrations should not be hard. They should be under version control and documented in both your production systems and in your project files.

What?

This library executes SQL/Haskell migration scripts and keeps track of their meta information.

Scripts are be executed exactly once and any changes to scripts will cause a run-time error notifying you of a corrupted database.

The meta information consists of:

  • an MD5 checksum of the executed script to make sure already existing scripts cannot be modified in your production system.
  • a time-stamp of the date of execution so you can easily track when a change happened.

This library also supports migration validation so you can ensure (some) correctness before your application logic kicks in.

How?

TODO

Compilation and Tests

The program is built with the cabal build system. The following command builds the library, the standalone binary and the test package.

cabal configure --enable-tests && cabal build -j

To execute the tests, you need a running PostgreSQL server with an empty database called test. Tests are executed through cabal as follows:

cabal configure --enable-tests && cabal test

To build the project in a cabal sandbox, use the following code:

cabal sandbox init
cabal install -j --only-dependencies --enable-tests --disable-documentation
cabal configure --enable-tests
cabal test

To remove the generated cabal sandbox, use:

cabal sandbox delete

To Do

  • Collect executed scripts and check if already executed scripts have been deleted.