method
revert
v6.0.0 -
Show latest stable
-
0 notes -
Class: ActiveRecord::Migration
- 1.0.0
- 1.1.6
- 1.2.6
- 2.0.3
- 2.1.0
- 2.2.1
- 2.3.8
- 3.0.0
- 3.0.9
- 3.1.0
- 3.2.1
- 3.2.8 (0)
- 3.2.13 (0)
- 4.0.2 (38)
- 4.1.8 (0)
- 4.2.1 (0)
- 4.2.7 (0)
- 4.2.9 (0)
- 5.0.0.1 (1)
- 5.1.7 (0)
- 5.2.3 (0)
- 6.0.0 (0)
- 6.1.3.1 (0)
- 6.1.7.7 (0)
- 7.0.0 (0)
- 7.1.3.2 (0)
- 7.1.3.4 (0)
- What's this?
revert(*migration_classes)
public
Reverses the migration commands for the given block and the given migrations.
The following migration will remove the table ‘horses’ and create the table ‘apples’ on the way up, and the reverse on the way down.
class FixTLMigration < ActiveRecord::Migration[5.0] def change revert do create_table(:horses) do |t| t.text :content t.datetime :remind_at end end create_table(:apples) do |t| t.string :variety end end end
Or equivalently, if TenderloveMigration is defined as in the documentation for Migration:
require_relative '20121212123456_tenderlove_migration' class FixupTLMigration < ActiveRecord::Migration[5.0] def change revert TenderloveMigration create_table(:apples) do |t| t.string :variety end end end
This command can be nested.