class Marten::DB::Management::Migrations::Graph
- Marten::DB::Management::Migrations::Graph
- Reference
- Object
Overview
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.
Defined in:
marten/db/management/migrations/graph.crmarten/db/management/migrations/graph/node.cr
Instance Method Summary
-
#add_dependency(migration : Migration, dependency_id : String)
Configures a migration dependency.
-
#add_node(migration : Migration)
Adds a migration object to the graph.
-
#ensure_acyclic_property : Nil
Verifies that the graph does not contain cycles.
-
#find_node(id : String)
Returns the node associated with a given migration ID.
-
#leaves
Return the leaves of the graph.
-
#path_backward(migration : Migration)
Returns an array of migration nodes to unapply in order to unapply a specific migration node node.
-
#path_backward(target_node : Node)
Returns an array of migration nodes to unapply in order to unapply a specific migration node node.
-
#path_forward(migration : Migration)
Returns an array of migration nodes to apply in order to apply a specific migration node.
-
#path_forward(target_node : Node)
Returns an array of migration nodes to apply in order to apply a specific migration node.
-
#roots
Return the roots of the graph.
-
#setup_replacement(migration : Migration)
Setup a replacement migration.
-
#teardown_replacement(migration : Migration)
Teardown a replacement migration.
-
#to_project_state
Returns the project state corresponding to the considered graph of migration nodes.
Instance Method Detail
Configures a migration dependency.
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.
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.
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.
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.
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.
Return the roots of the graph.
Roots correspond to migration nodes that don't have any dependencies inside their app.
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.
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.
Returns the project state corresponding to the considered graph of migration nodes.