class

Marten::DB::Management::Migrations::Graph

Inherits Reference / Object

Represents a directed acyclic graph of migrations.

In such graph, every migration corresponds to a node in the graph while dependencies between migrations correspond to edges. Thus if a migration X depends on a migration Y, an edge between Y and X will be defined indicating that Y must be applied before X.

Instance methods

add_dependency(migration : Migration, dependency_id : String)

Configures a migration dependency.

Source
add_node(migration : Migration)

Adds a migration object to the graph.

Source
ensure_acyclic_property

Verifies that the graph does not contain cycles.

Source
find_node(id : String)

Returns the node associated with a given migration ID.

Source
leaves

Return the leaves of the graph.

Leaves correspond to migration nodes that don't have any child (that is no other migrations depend on them) inside their app.

Source
path_backward(migration : Migration)

Returns an array of migration nodes to unapply in order to unapply a specific migration node node.

The returned array will start with the nodes that depend on the target node and will end with the target node. The resulting "path" should be followed in order to unapply the migration corresponding to the target node.

Source
path_backward(target_node : Node)

Returns an array of migration nodes to unapply in order to unapply a specific migration node node.

The returned array will start with the nodes that depend on the target node and will end with the target node. The resulting "path" should be followed in order to unapply the migration corresponding to the target node.

Source
path_forward(migration : Migration)

Returns an array of migration nodes to apply in order to apply a specific migration node.

The returned array will start with the depdendencies of the target node and will end with the target node. The resulting "path" should be followed in order to apply the migration corresponding to the target node.

Source
path_forward(target_node : Node)

Returns an array of migration nodes to apply in order to apply a specific migration node.

The returned array will start with the depdendencies of the target node and will end with the target node. The resulting "path" should be followed in order to apply the migration corresponding to the target node.

Source
roots

Return the roots of the graph.

Roots correspond to migration nodes that don't have any dependencies inside their app.

Source
setup_replacement(migration : Migration)

Setup a replacement migration.

From a Marten::DB::Migration object defining replacements, this method ensures that all the "replaced" migrations are removed from the current graph. All other migrations referencing the replaced migrations are updated to reference the replacing migration.

Source
teardown_replacement(migration : Migration)

Teardown a replacement migration.

From a Marten::DB::Migration object defining replacements, this method ensures that the replacement migration is removed from the graph and that the replacement migrations reference the replacement migration child nodes.

Source
to_project_state

Returns the project state corresponding to the considered graph of migration nodes.

Source

Nested types