Class DataMapper::Migration
In: lib/dm-migrations/migration.rb
Parent: Object

Methods

Included Modules

SQL

Attributes

name  [R]  The name of the migration
position  [R]  The position or version the migration belongs to
repository  [R]  The repository the migration operates on

Public Class methods

Creates a new migration.

@param [Symbol, String, Integer] position

  The position or version the migration belongs to.

@param [Symbol] name

  The name of the migration.

@param [Hash] options

  Additional options for the migration.

@option options [Boolean] :verbose (true)

  Enables or disables verbose output.

@option options [Symbol] :repository (:default)

  The DataMapper repository the migration will operate on.

Public Instance methods

Orders migrations by position, so we know what order to run them in. First order by position, then by name, so at least the order is predictable.

The adapter the migration will use.

@return [DataMapper::Adapter]

  The adapter the migration will operate on.

@since 1.0.1

The repository the migration will operate on.

@return [Symbol, nil]

  The name of the DataMapper repository the migration will run against.

@deprecated Use {repository} instead.

@since 1.0.1.

define the actions that should be performed on a down migration

Quoted table name, for the adapter

Quoted `migration_name` column, for the adapter

Fetch the record for this migration out of the migration_info table

True if the migration has already been run

True if the migration needs to be run

un-do the migration by running the code in the down block

perform the migration by running the code in the up block

Quote the name of the migration for use in SQL

Output some text. Optional indent level

Time how long the block takes to run, and output it with the message.

define the actions that should be performed on an up migration

Inserts or removes a row into the `migration_info` table, so we can mark this migration as run, or un-done

output the given text, but only if verbose mode is on

Protected Instance methods

Sets up the migration.

@since 1.0.1

Determines whether the migration has been setup.

@return [Boolean]

  Specifies whether the migration has been setup.

@since 1.0.1

[Validate]