phlawski-migration_fu 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/lib/migration_fu.rb +3 -3
- data/migration_fu.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -6,11 +6,11 @@ Rails gem / plugin for generating foreign key constraints.
|
|
6
6
|
|
7
7
|
=== as gem
|
8
8
|
|
9
|
-
sudo gem install
|
9
|
+
sudo gem install phlawski-migration_fu --source http://gems.github.com
|
10
10
|
|
11
11
|
=== or plugin
|
12
12
|
|
13
|
-
script/plugin install git://github.com/
|
13
|
+
script/plugin install git://github.com/phlawski/migration_fu.git
|
14
14
|
|
15
15
|
== Usage
|
16
16
|
|
data/lib/migration_fu.rb
CHANGED
@@ -40,10 +40,10 @@ module ActiveRecord
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def process(from_table, to_table, options)
|
43
|
-
id = options[:name]
|
43
|
+
id = options[:name] || "fk_#{from_table}_#{to_table}"
|
44
44
|
|
45
|
-
if id.size > MAX_KEY_LENGTH
|
46
|
-
id = id.slice(0...MAX_KEY_LENGTH)
|
45
|
+
if id.to_s.size > MAX_KEY_LENGTH
|
46
|
+
id = id.to_s.slice(0...MAX_KEY_LENGTH)
|
47
47
|
puts "Warning: foreign key id has more then #{MAX_KEY_LENGTH} characters - sliced to '#{id}'"
|
48
48
|
end
|
49
49
|
yield(from_table.to_s, to_table.to_s, id)
|
data/migration_fu.gemspec
CHANGED