dm-constraints 1.1.0.rc2 → 1.1.0.rc3
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile
CHANGED
@@ -5,7 +5,7 @@ source 'http://rubygems.org'
|
|
5
5
|
SOURCE = ENV.fetch('SOURCE', :git).to_sym
|
6
6
|
REPO_POSTFIX = SOURCE == :path ? '' : '.git'
|
7
7
|
DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
|
8
|
-
DM_VERSION = '~> 1.1.0.
|
8
|
+
DM_VERSION = '~> 1.1.0.rc3'
|
9
9
|
DO_VERSION = '~> 0.10.2'
|
10
10
|
DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
|
11
11
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.0.
|
1
|
+
1.1.0.rc3
|
data/dm-constraints.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dm-constraints}
|
8
|
-
s.version = "1.1.0.
|
8
|
+
s.version = "1.1.0.rc3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Dirkjan Bussink"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-10}
|
13
13
|
s.description = %q{DataMapper plugin constraining relationships}
|
14
14
|
s.email = %q{d.bussink [a] gmail [d] com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -48,7 +48,7 @@ Gem::Specification.new do |s|
|
|
48
48
|
s.homepage = %q{http://github.com/datamapper/dm-constraints}
|
49
49
|
s.require_paths = ["lib"]
|
50
50
|
s.rubyforge_project = %q{datamapper}
|
51
|
-
s.rubygems_version = %q{1.
|
51
|
+
s.rubygems_version = %q{1.6.2}
|
52
52
|
s.summary = %q{DataMapper plugin constraining relationships}
|
53
53
|
s.test_files = [
|
54
54
|
"spec/integration/constraints_spec.rb",
|
@@ -62,18 +62,18 @@ Gem::Specification.new do |s|
|
|
62
62
|
s.specification_version = 3
|
63
63
|
|
64
64
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
65
|
-
s.add_runtime_dependency(%q<dm-core>, ["~> 1.1.0.
|
65
|
+
s.add_runtime_dependency(%q<dm-core>, ["~> 1.1.0.rc3"])
|
66
66
|
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
67
67
|
s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
|
68
68
|
s.add_development_dependency(%q<rspec>, ["~> 1.3.1"])
|
69
69
|
else
|
70
|
-
s.add_dependency(%q<dm-core>, ["~> 1.1.0.
|
70
|
+
s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc3"])
|
71
71
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
72
72
|
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
73
73
|
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
74
74
|
end
|
75
75
|
else
|
76
|
-
s.add_dependency(%q<dm-core>, ["~> 1.1.0.
|
76
|
+
s.add_dependency(%q<dm-core>, ["~> 1.1.0.rc3"])
|
77
77
|
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
78
78
|
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
79
79
|
s.add_dependency(%q<rspec>, ["~> 1.3.1"])
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'dm-core/ext/string'
|
2
|
+
|
1
3
|
module DataMapper
|
2
4
|
module Constraints
|
3
5
|
module Adapters
|
@@ -15,13 +17,13 @@ module DataMapper
|
|
15
17
|
#
|
16
18
|
# @api private
|
17
19
|
def constraint_exists?(storage_name, constraint_name)
|
18
|
-
statement = <<-SQL
|
20
|
+
statement = DataMapper::Ext::String.compress_lines(<<-SQL)
|
19
21
|
SELECT COUNT(*)
|
20
|
-
FROM
|
21
|
-
WHERE
|
22
|
-
AND
|
23
|
-
AND
|
24
|
-
AND
|
22
|
+
FROM #{quote_name('information_schema')}.#{quote_name('table_constraints')}
|
23
|
+
WHERE #{quote_name('constraint_type')} = 'FOREIGN KEY'
|
24
|
+
AND #{quote_name('table_schema')} = ?
|
25
|
+
AND #{quote_name('table_name')} = ?
|
26
|
+
AND #{quote_name('constraint_name')} = ?
|
25
27
|
SQL
|
26
28
|
|
27
29
|
select(statement, schema_name, storage_name, constraint_name).first > 0
|
@@ -133,7 +135,7 @@ module DataMapper
|
|
133
135
|
#
|
134
136
|
# @api private
|
135
137
|
def create_constraints_statement(storage_name, constraint_name, constraint_type, foreign_keys, reference_storage_name, reference_keys)
|
136
|
-
<<-SQL
|
138
|
+
DataMapper::Ext::String.compress_lines(<<-SQL)
|
137
139
|
ALTER TABLE #{quote_name(storage_name)}
|
138
140
|
ADD CONSTRAINT #{quote_name(constraint_name)}
|
139
141
|
FOREIGN KEY (#{foreign_keys.join(', ')})
|
@@ -156,7 +158,7 @@ module DataMapper
|
|
156
158
|
#
|
157
159
|
# @api private
|
158
160
|
def destroy_constraints_statement(storage_name, constraint_name)
|
159
|
-
<<-SQL
|
161
|
+
DataMapper::Ext::String.compress_lines(<<-SQL)
|
160
162
|
ALTER TABLE #{quote_name(storage_name)}
|
161
163
|
DROP CONSTRAINT #{quote_name(constraint_name)}
|
162
164
|
SQL
|
@@ -24,7 +24,7 @@ module DataMapper
|
|
24
24
|
#
|
25
25
|
# @api private
|
26
26
|
def destroy_constraints_statement(storage_name, constraint_name)
|
27
|
-
<<-SQL
|
27
|
+
DataMapper::Ext::String.compress_lines(<<-SQL)
|
28
28
|
ALTER TABLE #{quote_name(storage_name)}
|
29
29
|
DROP FOREIGN KEY #{quote_name(constraint_name)}
|
30
30
|
SQL
|
@@ -12,7 +12,7 @@ module DataMapper
|
|
12
12
|
# @see DataMapper::Constraints::Adapters::DataObjectsAdapter
|
13
13
|
# @api private
|
14
14
|
def constraint_exists?(storage_name, constraint_name)
|
15
|
-
statement = <<-SQL
|
15
|
+
statement = DataMapper::Ext::String.compress_lines(<<-SQL)
|
16
16
|
SELECT COUNT(*)
|
17
17
|
FROM USER_CONSTRAINTS
|
18
18
|
WHERE table_name = ?
|
@@ -25,7 +25,7 @@ module DataMapper
|
|
25
25
|
|
26
26
|
# @see DataMapper::Constraints::Adapters::DataObjectsAdapter#create_constraints_statement
|
27
27
|
def create_constraints_statement(storage_name, constraint_name, constraint_type, foreign_keys, reference_storage_name, reference_keys)
|
28
|
-
<<-SQL
|
28
|
+
DataMapper::Ext::String.compress_lines(<<-SQL)
|
29
29
|
ALTER TABLE #{quote_name(storage_name)}
|
30
30
|
ADD CONSTRAINT #{quote_name(constraint_name)}
|
31
31
|
FOREIGN KEY (#{foreign_keys.join(', ')})
|
@@ -35,7 +35,7 @@ module DataMapper
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def destroy_constraints_statement(storage_name, constraint_name)
|
38
|
-
<<-SQL
|
38
|
+
DataMapper::Ext::String.compress_lines(<<-SQL)
|
39
39
|
ALTER TABLE #{quote_name(storage_name)}
|
40
40
|
DROP CONSTRAINT #{quote_name(constraint_name)}
|
41
41
|
CASCADE
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: dm-constraints
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 1.1.0.
|
5
|
+
version: 1.1.0.rc3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dirkjan Bussink
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-03-
|
13
|
+
date: 2011-03-10 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.1.0.
|
23
|
+
version: 1.1.0.rc3
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements: []
|
119
119
|
|
120
120
|
rubyforge_project: datamapper
|
121
|
-
rubygems_version: 1.
|
121
|
+
rubygems_version: 1.6.2
|
122
122
|
signing_key:
|
123
123
|
specification_version: 3
|
124
124
|
summary: DataMapper plugin constraining relationships
|