Class: DataMapper::Migration

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

### Methods

<=> create_index create_migration_info_table_if_needed create_table down drop_table execute migration_info_table migration_info_table_exists? migration_name_column migration_record modify_table needs_down? needs_up? new perform_down perform_up quote_column_name quote_table_name quoted_name say say_with_time up update_migration_info write

### Included Modules

SQL

### Constants

VERSION | = | '0.10.1'.freeze

### Attributes

adapter | [RW] |
database | [RW] |
name | [RW] |
position | [RW] |

### Public Class methods

new( position, name, opts = {}, &block )

### Public Instance methods

<=>(other)

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

create_index(table_name, *columns_and_options)
create_migration_info_table_if_needed()
create_table(table_name, opts = {}, &block)
down(&block)

define the actions that should be performed on a down migration

drop_table(table_name, opts = {})
execute(sql, *bind_values)

execute raw SQL

migration_info_table()

Quoted table name, for the adapter

migration_info_table_exists?()
migration_name_column()

Quoted `migration_name` column, for the adapter

migration_record()

Fetch the record for this migration out of the migration_info table

modify_table(table_name, opts = {}, &block)
needs_down?()

True if the migration has already been run

needs_up?()

True if the migration needs to be run

perform_down()

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

perform_up()

perform the migration by running the code in the up block

quote_column_name(column_name)
quote_table_name(table_name)
quoted_name()

Quote the name of the migration for use in SQL

say(message, indent = 4)

Output some text. Optional indent level

say_with_time(message, indent = 2) {|| ...}

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

up(&block)

define the actions that should be performed on an up migration

update_migration_info(direction)

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

write(text="")

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

[Validate]