Skip to content

class Athena::ORM::Migrations::Version::MigrationPlanCalculator
inherits Reference #

Plans which migrations to execute, and in which direction, to reach a version.

Constructors#

Methods#

#migrations : AORM::Migrations::Metadata::AvailableMigrationsList#

Returns the available migrations, ordered by version.

View source

#plan_for_versions(versions : Enumerable(AORM::Migrations::Version), direction : AORM::Migrations::Version::Direction) : AORM::Migrations::Metadata::MigrationPlanList#

Returns the plan to execute the migrations with the provided versions in direction, whether or not they have already been executed. They're planned in order of their versions, or in reverse order when reverting them.

Raises AORM::Migrations::Exception::MigrationClassNotFound if there's no migration with one of the versions.

View source

#plan_until_version(to : AORM::Migrations::Version) : AORM::Migrations::Metadata::MigrationPlanList#

Returns the plan to migrate the database to the version to, applying the migrations up to and including it that haven't been executed, or reverting the executed ones after it. A version of 0 reverts every executed migration.

Raises AORM::Migrations::Exception::MigrationClassNotFound if there's no migration with the version to.

View source