The inverters of the reversible schema statements, which ActiveRecord::CommandRecorder#inverse_of looks up by the name of the statement. A statement that has no inverter cannot be reverted automatically.

Statement name -> function that takes the arguments of the statement (a list with their count under 'n') and returns the inverse statement.

Summary

Functions

Inverts add_column into remove_column.
Inverts add_foreign_key into remove_foreign_key.
Inverts add_index into remove_index of the same columns.
Inverts add_reference into remove_reference.
Inverts add_timestamps into remove_timestamps.
Inverts create_reference into remove_foreign_key of the reference's key.
Inverts create_table into drop_table.
Inverts define_model into a drop_table of the model's table.
Inverts drop_table into create_table, or into define_model for a model's table.
Inverts execute_block into itself: the block is run either way, and decides what to do from the direction of the migration.
Inverts remove_column into add_column.
Inverts remove_foreign_key into add_foreign_key.
Inverts remove_index into add_index.
Inverts remove_reference into add_reference.
Inverts remove_timestamps into add_timestamps.
Inverts rename_column by swapping the column names.
Inverts rename_table by swapping the names.

Functions

Inverts add_column into remove_column.

Parameters

  • args

inverters.add_foreign_key(args)

shared packages/active_record/lib/migrator/command_recorder.lua:176

Inverts add_foreign_key into remove_foreign_key.

Parameters

  • args

Inverts add_index into remove_index of the same columns. Understands both the positional and the table form of the arguments.

Parameters

  • args

Inverts add_reference into remove_reference.

Parameters

  • args

inverters.add_timestamps(args)

shared packages/active_record/lib/migrator/command_recorder.lua:114

Inverts add_timestamps into remove_timestamps.

Parameters

  • args

inverters.create_reference(args)

shared packages/active_record/lib/migrator/command_recorder.lua:191

Inverts create_reference into remove_foreign_key of the reference's key.

Parameters

  • args

Inverts create_table into drop_table. The table definition is kept, so that the drop_table can be inverted back.

Parameters

  • args

Inverts define_model into a drop_table of the model's table.

Parameters

  • args

Inverts drop_table into create_table, or into define_model for a model's table. Raises an error if the table definition is not given.

Parameters

  • args

Inverts execute_block into itself: the block is run either way, and decides what to do from the direction of the migration.

Parameters

  • args

Inverts remove_column into add_column. Raises an error if the type of the column is not given.

Parameters

  • args

inverters.remove_foreign_key(args)

shared packages/active_record/lib/migrator/command_recorder.lua:182

Inverts remove_foreign_key into add_foreign_key. Raises an error if the referenced table is not given.

Parameters

  • args

Inverts remove_index into add_index. Raises an error if the column(s) of the index are not given.

Parameters

  • args

inverters.remove_reference(args)

shared packages/active_record/lib/migrator/command_recorder.lua:129

Inverts remove_reference into add_reference.

Parameters

  • args

inverters.remove_timestamps(args)

shared packages/active_record/lib/migrator/command_recorder.lua:119

Inverts remove_timestamps into add_timestamps.

Parameters

  • args

Inverts rename_column by swapping the column names.

Parameters

  • args

Inverts rename_table by swapping the names.

Parameters

  • args

Defined in