hasql-migration: PostgreSQL Schema Migrations

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

A hasql schema migration utility


[Skip to Readme]

Modules

[Last Documentation]

  • Hasql
    • Hasql.Migration
      • Hasql.Migration.Util

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, 0.3.1
Dependencies base (>=4.7 && <5), bytestring (>=0.10), contravariant (>=1.3), crypton (>=0.32), directory (>=1.2), hasql (>=1.4), 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.net>
Maintainer Timo von Holtz <tvh@tvholtz.net>
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 2024-07-05T18:07:27Z
Distributions LTSHaskell:0.3.1, NixOS:0.3.1, Stackage:0.3.1
Reverse Dependencies 3 direct, 0 indirect [details]
Downloads 4744 total (40 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2024-07-05 [all 2 reports]

Readme for hasql-migration-0.3.1

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