Skip to content

class Athena::ORM::Migrations::Metadata::Storage::TableMetadataStorage
inherits Reference #

Records the executed migrations in a table of the database they're executed on.

The table is created by #ensure_initialized.

Todo

Tables in a different layout, such as when the configured column length is changed after the table is created, aren't detected or upgraded.

Included modules

Athena::ORM::Migrations::Metadata::Storage::Interface

Constructors#

.new(connection : AORM::Connection, configuration : AORM::Migrations::Metadata::Storage::TableMetadataStorageConfiguration = AORM::Migrations::Metadata::Storage::TableMetadataStorageConfiguration.new)#

View source

Methods#

#complete(result : AORM::Migrations::Version::ExecutionResult) : Nil#

Records the migration of result as executed if it was applied, or as no longer executed if it was reverted.

View source

#ensure_initialized : Nil#

Prepares the storage to record executed migrations, such as by creating the table they're recorded in.

Creates the table if it doesn't exist.

View source

#executed_migrations : AORM::Migrations::Metadata::ExecutedMigrationsList#

Returns the migrations that have been executed, ordered by version.

Returns an empty list if the table doesn't exist yet.

View source

#reset : Nil#

Forgets every executed migration.

View source

#sql(result : AORM::Migrations::Version::ExecutionResult) : Array(AORM::Migrations::Query)#

Returns the SQL #complete would execute for result, such as to show it during a dry run.

View source