hasql-migration: PostgreSQL Schema Migrations

[ bsd3, database, library ] [ Propose Tags ] [ Report a vulnerability ]

A PostgreSQL-simple schema migration utility


[Skip to Readme]

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

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.2.0, 0.3.0, 0.3.1
Dependencies base (>=4.7 && <5.0), base64-bytestring (>=1.0 && <1.1), bytestring (>=0.10 && <0.11), contravariant (>=1.3 && <1.5), cryptohash (>=0.11 && <0.12), data-default-class (>=0.0.1 && <0.2), directory (>=1.2 && <1.3), hasql (>=0.19 && <0.20), hasql-transaction (>=0.4 && <0.5), text (>=1.2 && <1.3), time (>=1.4 && <1.7) [details]
License BSD-3-Clause
Copyright Timo von Holtz, Andreas Meingast
Author Timo von Holtz <tvh@tvholtz.de>
Maintainer Timo von Holtz <tvh@tvholtz.de>
Revised Revision 1 made by TvH at 2016-12-15T22:06:21Z
Category Database
Home page https://github.com/tvh/hasql-migration
Bug tracker https://github.com/tvh/hasql-migration/issues
Source repo head: git clone git://github.com/tvh/hasql-migration
Uploaded by TvH at 2016-12-15T22:04:54Z
Distributions LTSHaskell:0.3.1, NixOS:0.3.1, Stackage:0.3.1
Reverse Dependencies 3 direct, 0 indirect [details]
Downloads 4761 total (41 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-12-15 [all 1 reports]

Readme for hasql-migration-0.1.0

[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.