dbmigrations-2.0.0: An implementation of relational database "migrations"

Safe HaskellNone
LanguageHaskell2010

Database.Schema.Migrations.Dependencies

Description

This module types and functions for representing a dependency graph of arbitrary objects and functions for querying such graphs to get dependency and reverse dependency information.

Synopsis

Documentation

class (Eq a, Ord a) => Dependable a where Source #

Dependable objects supply a representation of their identifiers, and a list of other objects upon which they depend.

Minimal complete definition

depsOf, depId

Methods

depsOf :: a -> [String] Source #

The identifiers of the objects on which a depends.

depId :: a -> String Source #

The identifier of a Dependable object.

data DependencyGraph a Source #

A DependencyGraph represents a collection of objects together with a graph of their dependency relationships. This is intended to be used with instances of Dependable.

Constructors

DG 

Fields

mkDepGraph :: Dependable a => [a] -> Either String (DependencyGraph a) Source #

Build a dependency graph from a list of Dependables. Return the graph on success or return an error message if the graph cannot be constructed (e.g., if the graph contains a cycle).

dependencies :: Dependable d => DependencyGraph d -> String -> [String] Source #

Given a dependency graph and an ID, return the IDs of objects that the object depends on. IDs are returned with least direct dependencies first (i.e., the apply order).

reverseDependencies :: Dependable d => DependencyGraph d -> String -> [String] Source #

Given a dependency graph and an ID, return the IDs of objects that depend on it. IDs are returned with least direct reverse dependencies first (i.e., the revert order).