objectreload-foreign_key_extensions 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/lib/foreign_key_extensions.rb +9 -3
- data/objectreload-foreign_key_extensions.gemspec +4 -4
- data/rails/init.rb +1 -0
- metadata +4 -4
- data/init.rb +0 -2
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: UTF-8
|
1
2
|
require 'rubygems'
|
2
3
|
require 'rake'
|
3
4
|
|
@@ -8,7 +9,7 @@ begin
|
|
8
9
|
gem.summary = "Simple way to create foreign keys in migration files."
|
9
10
|
gem.email = "gems@objectreload.com"
|
10
11
|
gem.homepage = "http://github.com/objectreload/foreign_key_extensions"
|
11
|
-
gem.authors = ["Mateusz
|
12
|
+
gem.authors = ["Mateusz Drożdżyński"]
|
12
13
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
14
|
end
|
14
15
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -11,7 +11,11 @@ module ForeignKeyExtensions
|
|
11
11
|
constraint = constraint_name(from_table, from_column)
|
12
12
|
|
13
13
|
failsafe do
|
14
|
-
|
14
|
+
if mysql?
|
15
|
+
execute %{alter table #{from_table} drop foreign key #{constraint}}
|
16
|
+
else
|
17
|
+
execute %{alter table #{from_table} drop constraint #{constraint}}
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
@@ -21,6 +25,10 @@ module ForeignKeyExtensions
|
|
21
25
|
|
22
26
|
protected
|
23
27
|
|
28
|
+
def mysql?
|
29
|
+
ActiveRecord::Base.connection.adapter_name == "MySQL"
|
30
|
+
end
|
31
|
+
|
24
32
|
def failsafe(&block)
|
25
33
|
begin
|
26
34
|
block.call
|
@@ -30,5 +38,3 @@ module ForeignKeyExtensions
|
|
30
38
|
end
|
31
39
|
end
|
32
40
|
end
|
33
|
-
|
34
|
-
ActiveRecord::Migration.send(:extend, ForeignKeyExtensions)
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{objectreload-foreign_key_extensions}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Mateusz
|
12
|
-
s.date = %q{
|
11
|
+
s.authors = ["Mateusz Drożdżyński"]
|
12
|
+
s.date = %q{2010-02-16}
|
13
13
|
s.email = %q{gems@objectreload.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README"
|
@@ -19,10 +19,10 @@ Gem::Specification.new do |s|
|
|
19
19
|
"README",
|
20
20
|
"Rakefile",
|
21
21
|
"VERSION",
|
22
|
-
"init.rb",
|
23
22
|
"install.rb",
|
24
23
|
"lib/foreign_key_extensions.rb",
|
25
24
|
"objectreload-foreign_key_extensions.gemspec",
|
25
|
+
"rails/init.rb",
|
26
26
|
"test/foreign_key_extensions_test.rb",
|
27
27
|
"test/test_helper.rb",
|
28
28
|
"uninstall.rb"
|
data/rails/init.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ActiveRecord::Migration.send(:extend, ForeignKeyExtensions)
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: objectreload-foreign_key_extensions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Mateusz
|
7
|
+
- "Mateusz Dro\xC5\xBCd\xC5\xBCy\xC5\x84ski"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-16 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -26,10 +26,10 @@ files:
|
|
26
26
|
- README
|
27
27
|
- Rakefile
|
28
28
|
- VERSION
|
29
|
-
- init.rb
|
30
29
|
- install.rb
|
31
30
|
- lib/foreign_key_extensions.rb
|
32
31
|
- objectreload-foreign_key_extensions.gemspec
|
32
|
+
- rails/init.rb
|
33
33
|
- test/foreign_key_extensions_test.rb
|
34
34
|
- test/test_helper.rb
|
35
35
|
- uninstall.rb
|
data/init.rb
DELETED