dbmigrations-2.1.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.

Methods

depsOf :: a -> [Text] Source #

The identifiers of the objects on which a depends.

depId :: a -> Text Source #

The identifier of a Dependable object.

Instances

Instances details
Dependable Migration Source # 
Instance details

Defined in Database.Schema.Migrations.Migration

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

Instances

Instances details
Eq a => Eq (DependencyGraph a) Source # 
Instance details

Defined in Database.Schema.Migrations.Dependencies

Show a => Show (DependencyGraph a) Source # 
Instance details

Defined in Database.Schema.Migrations.Dependencies

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 -> Text -> [Text] 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 -> Text -> [Text] 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).