Module: SO2DB::FKHelper

Included in:
CreateOptionalRelationships, CreateRelationships
Defined in:
lib/so2db/migrations.rb

Instance Method Summary collapse

Instance Method Details

#add_fk(from_table, to_table, options = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/so2db/migrations.rb', line 32

def add_fk(from_table, to_table, options={})
  begin
  AddForeignKeyMigration.new(from_table, to_table, options).up
  rescue
  puts $!.inspect
  #puts $@
    s = "Error creating foreign key from #{from_table} to #{to_table}"
    s << " on column #{options[:column]}" if options.has_key? :column
    puts s
  end
end