Sha256: c40fbaf9315d6ce77be1f88efc648f817ad70b92b98a9d5e4b47b5b04ad4904a

Contents?: true

Size: 300 Bytes

Versions: 3

Compression:

Stored size: 300 Bytes

Contents

module ActiveRecord
	class Migration
	  def self.add_foreign_key(from_table, from_column, to_table)
		constraint_name = "fk_#{from_table}_#{from_column}"		
		execute %{ALTER TABLE #{from_table} ADD CONSTRAINT #{constraint_name} FOREIGN KEY (#{from_column}) REFERENCES #{to_table}(id)}
	  end
	end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
appcelerator-2.0.1.1 lib/appcelerator/migration.rb
appcelerator-2.0.2 lib/appcelerator/migration.rb
seamless-1.0.0 lib/seamless/migration.rb