Foreign Key Schema Dumper plugin
Plugin details
Documentation
Download the plugin at http://www.bubbleshare.com/tools/ActiveRecordExtensions.zip
You can use this plugin for your migrations as well. The syntax for adding FK constraints is:
add_foreign_key_constraint table, foreign_key, reference_table, reference_column, :name => optional_constraint_name, :on_update => optional_on_update_action, :on_delete => optional_on_delete_action
The actions are symbols. One of: :cascade, :set_null, or :restrict
If you don’t want any action, “no action”, then just omit these optional parameters.
For removing:
You have two options:
1. :name => the name of the foreign key constraint
2. :foreign_key => the name of the column for which the foreign key was created (only if the default constraint_name was used)
Note: This is for inside ActiveRecord::Schema not inside migrations. You can use remove_foreign_key_constraint but it takes just the table name and constraint name
For example:
remove_foreign_key_constraint 'pictures', :foreign_key => 'user_id'
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | Back in time (1 older version) | Last edited by: scott, 7 months ago

