Skip to content

one pinned.nix #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
.*.swp
.cabal-sandbox
cabal.sandbox.config
cabal.project
dist
dist-newstyle
result

.cabal-sandbox
dist
dist-newstyle
.*.swp
result
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Do not choose a language; we provide our own build tools.
language: generic

before_install:
- wget https://www.haskell.org/platform/download/8.4.3/haskell-platform-8.4.3-unknown-posix--full-x86_64.tar.gz
- tar xf haskell-platform-8.4.3-unknown-posix--full-x86_64.tar.gz
- sudo ./install-haskell-platform.sh
- cabal --version

install:
- cabal update
- cabal install --enable-tests

script:
- cabal test
- cabal haddock
Empty file added CHANGELOG.md
Empty file.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# dbmigrations-postgresql
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages: dbmigrations-postgresql/ dbmigrations/
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,9 @@ Source-Repository head

Executable moo-postgresql
default-language: Haskell2010
Build-Depends:
base >= 4 && < 5,
dbmigrations >= 2,
HDBC-postgresql
Build-Depends: base >= 4 && < 5
, dbmigrations
, HDBC-postgresql

if impl(ghc >= 6.12.0)
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields
Expand All @@ -41,25 +40,23 @@ Executable moo-postgresql
Hs-Source-Dirs: programs
Main-is: MooPostgreSQL.hs

test-suite dbmigrations-postgresql-tests
default-language: Haskell2010
type: exitcode-stdio-1.0
Build-Depends:
base >= 4 && < 5,
dbmigrations >= 2,
HDBC >= 2.2.1,
HDBC-postgresql == 2.3.2.4,
process >= 1.1,
HUnit >= 1.2

other-modules:
TestDriver

if impl(ghc >= 6.12.0)
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields
-fno-warn-unused-do-bind -Wwarn
else
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields

Hs-Source-Dirs: test
Main-is: TestDriver.hs
-- Commented
-- test-suite dbmigrations-postgresql-tests
-- default-language: Haskell2010
-- type: exitcode-stdio-1.0
-- Build-Depends:
-- base >= 4 && < 5,
-- dbmigrations >= 2,
-- HDBC >= 2.2.1,
-- HDBC-postgresql == 2.3.2.7,
-- process >= 1.1,
-- HUnit >= 1.2

-- if impl(ghc >= 6.12.0)
-- ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields
-- -fno-warn-unused-do-bind -Wwarn
-- else
-- ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields

-- Hs-Source-Dirs: test
-- Main-is: Main.hs
16 changes: 16 additions & 0 deletions dbmigrations-postgresql/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ mkDerivation, base, dbmigrations, HDBC, HDBC-postgresql, HUnit
, process, stdenv
}:
mkDerivation {
pname = "dbmigrations-postgresql";
version = "2.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base dbmigrations HDBC-postgresql ];
testHaskellDepends = [
base dbmigrations HDBC HDBC-postgresql HUnit process
];
description = "The dbmigrations tool built for PostgreSQL databases";
license = stdenv.lib.licenses.bsd3;
}
File renamed without changes.
4 changes: 4 additions & 0 deletions dbmigrations-postgresql/release.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
let
pkgs = import ../nix/pinned.nix {};
in
pkgs.haskellPackages.callPackage ./default.nix {}
14 changes: 14 additions & 0 deletions dbmigrations-postgresql/shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{ nixpkgs ? import ../nix/pinned.nix {} }:
let
inherit ( nixpkgs ) pkgs;
inherit ( pkgs ) haskellPackages;

project = import ./release.nix;
in
pkgs.stdenv.mkDerivation {
name = "dbmigrations-postgresql";
buildInputs = project.env.nativeBuildInputs ++ [
haskellPackages.cabal-install
haskellPackages.ghcid
];
}
28 changes: 15 additions & 13 deletions test/TestDriver.hs → dbmigrations-postgresql/test/Main.hs
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where

import Database.Schema.Migrations.Backend.HDBC (hdbcBackend)
import Database.Schema.Migrations.Test.BackendTest as BackendTest
import Database.Schema.Migrations.Backend.HDBC (hdbcBackend)
import Database.Schema.Migrations.Test.BackendTest as BackendTest

import Control.Exception (catch, catches, finally, Handler(..), SomeException )
import Database.HDBC ( IConnection(disconnect) )
import qualified Database.HDBC as HDBC
import qualified Database.HDBC.PostgreSQL as PostgreSQL
import System.Exit
import System.IO ( stderr )
import System.Process ( system )
import Test.HUnit
import Control.Exception (Handler (..),
SomeException,
catch, catches,
finally)
import Database.HDBC (IConnection (disconnect))
import qualified Database.HDBC as HDBC
import qualified Database.HDBC.PostgreSQL as PostgreSQL
import System.Exit
import System.IO (stderr)
import System.Process (system)
import Test.HUnit

data PostgreSQLBackendConnection =
forall a. HDBC.IConnection a => HDBCConnection a
data PostgreSQLBackendConnection = forall a . HDBC.IConnection a => HDBCConnection a

instance BackendConnection PostgreSQLBackendConnection where
supportsTransactionalDDL = const True
Expand Down
67 changes: 67 additions & 0 deletions dbmigrations/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
2.0.0
-----

This release contains breaking changes!

- Factored out all database-specific functionality into separate
packages (thanks Bastian Krol)
- Replaced "moo" program with one that emits an error instructing users
to use backend-specific dbmigrations packages
- Added missing test data files to package
- Removed `DBM_DATABASE_TYPE` environment variable in favor of backend
selection by use of backend-specific packages
- Allow `DBM_TIMESTAMP_FILENAMES` to be set via environment variable
(thanks Alexander Lippling)

1.1.1
-----

- Improve configuration validation error messages and clean up
validation routine
- Reinstate support for GHC 7.8

1.1
---

- Add support for MySQL databases (thanks Ollie Charles
<[email protected]>). Please see MOO.TXT for a disclaimer about this
feature!

1.0
---

- Added support for (optionally) adding timestamps to generated
migration filenames (thanks Matt Parsons <[email protected]>)
* Adds flag for time stamp on file names
* Adds configuration for timestamping filenames
- Added new "linear migrations" feature (thanks Jakub Fijałkowski
<[email protected]>, Andrew Martin <[email protected]>). This
feature is an optional alternative to the default behavior: rather than
prompting the user for dependencies of new migrations (the default
behavior), linear mode automatically selects dependencies for new
migrations such that they depend on the smallest subset of migrations
necessary to (effectively) depend on all existing migrations, thus
"linearizing" the migration sequence. See MOO.TXT for details.
- Configuration file loading now defaults to "moo.cfg" in the CWD if
--config-file is not specified, and environment variables override
settings in the config file

0.9.1
-----

- Restored default timestamp and description values in migrations
created by new migration command

0.9
---

- Fix 'moo' usage output to use correct program name
- Replaced Backend type class in favor of concrete Backend record type
- Added hdbcBackend constructor
- Backends now always run in IO rather than some MonadIO
- Removed monad parameter from MigrationStore (always use IO)
- Replaced MigrationStore type class with concrete MigrationStore type
- Added filesystem migration store constructor
- Improve configuration type so that it has been implicitly validated
- Made newMigration pure, made migration timestamps optional
- createNewMigration now takes a Migration for greater caller control
30 changes: 30 additions & 0 deletions dbmigrations/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Copyright (c) 2009, Jonathan Daugherty.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.

* The names of the contributors may not be used to endorse or
promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Loading