hasql-migration: PostgreSQL Schema Migrations

[ bsd3, database, library ] [ Propose Tags ]

A PostgreSQL-simple schema migration utility


[Skip to Readme]

Downloads

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
Dependencies base (>=4.7 && <5), bytestring (>=0.10), contravariant (>=1.3), cryptonite (>=0.11), data-default-class (>=0.0.1), directory (>=1.2), hasql (>=1.3), hasql-transaction (>=0.7), memory, text (>=1.2), time (>=1.4) [details]
License BSD-3-Clause
Copyright Timo von Holtz, Andreas Meingast, Sumit Raja
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 repo head: git clone git://github.com/tvh/hasql-migration
Uploaded by TvH at 2018-06-26T22:01:54Z
Distributions LTSHaskell:0.3.0, NixOS:0.3.0, Stackage:0.3.0
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 4504 total (29 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-06-26 [all 1 reports]

Readme for hasql-migration-0.2.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.