Skip to content

Commit

Permalink
Document that add_foreign_key is usually reversible
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Aug 15, 2024
1 parent a368d65 commit f851d1b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion doc/migration.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ the following methods:
* +alter_table+ (supporting the following methods in the +alter_table+ block):
* +add_column+
* +add_constraint+
* +add_foreign_key+ (with a symbol, not an array)
* +add_foreign_key+ (in most cases)
* +add_primary_key+ (with a symbol, not an array)
* +add_index+
* +add_full_text_index+
Expand All @@ -90,6 +90,10 @@ the following methods:

If you use any other methods, you should create your own +down+ block.

For +add_foreign_key+, it is reversible if passing a symbol, and reversible if passing an
array if Sequel can determine the name of the foreign key constraint to drop (which it
can for most databases).

To revert a migration created with +change+, you can copy the migration to a new file, and
replace +change+ with +revert+. For example, if you no longer need the artists table, you
can use the following migration. This will drop the artists table when migrating up, and
Expand Down

0 comments on commit f851d1b

Please sign in to comment.