partitioned 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.travis.yml +15 -0
- data/lib/partitioned/by_daily_time_field.rb +1 -1
- data/lib/partitioned/version.rb +1 -1
- data/lib/partitioned.rb +2 -1
- data/partitioned.gemspec +3 -2
- data/spec/monkey_patch_posgres_spec.rb +16 -16
- data/spec/partitioned/by_created_at_spec.rb +2 -2
- data/spec/partitioned/by_daily_time_field_spec.rb +7 -7
- data/spec/partitioned/by_foreign_key_spec.rb +7 -7
- data/spec/partitioned/by_id_spec.rb +6 -6
- data/spec/partitioned/by_integer_field_spec.rb +12 -12
- data/spec/partitioned/by_monthly_time_field_spec.rb +7 -7
- data/spec/partitioned/by_time_field_spec.rb +22 -22
- data/spec/partitioned/by_weekly_time_field_spec.rb +7 -7
- data/spec/partitioned/by_yearly_time_field_spec.rb +7 -7
- data/spec/partitioned/multi_level/configurator/dsl_spec.rb +9 -8
- data/spec/partitioned/multi_level/configurator/reader_spec.rb +14 -14
- data/spec/partitioned/partitioned_base/configurator/dsl_spec.rb +39 -38
- data/spec/partitioned/partitioned_base/configurator/reader_spec.rb +48 -48
- data/spec/partitioned/partitioned_base/sql_adapter_spec.rb +15 -15
- data/spec/partitioned/partitioned_base_spec.rb +20 -20
- data/spec/spec_helper.rb +11 -1
- data/spec/support/shared_example_spec_helper_for_integer_key.rb +19 -19
- data/spec/support/shared_example_spec_helper_for_time_key.rb +20 -20
- metadata +37 -36
@@ -8,8 +8,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
8
8
|
context "when try to create one record" do
|
9
9
|
|
10
10
|
it "record created" do
|
11
|
-
|
12
|
-
}.
|
11
|
+
expect { subject.create(:name => 'Phil', :company_id => 3, :integer_field => 2)
|
12
|
+
}.not_to raise_error
|
13
13
|
end
|
14
14
|
|
15
15
|
end # when try to create one record
|
@@ -17,10 +17,10 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
17
17
|
context "when try to create one record using new/save" do
|
18
18
|
|
19
19
|
it "record created" do
|
20
|
-
|
20
|
+
expect {
|
21
21
|
instance = subject.new(:name => 'Mike', :company_id => 1, :integer_field => 1)
|
22
22
|
instance.save!
|
23
|
-
}.
|
23
|
+
}.not_to raise_error
|
24
24
|
end
|
25
25
|
|
26
26
|
end # when try to create one record using new/save
|
@@ -28,10 +28,10 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
28
28
|
context "when try to create many records" do
|
29
29
|
|
30
30
|
it "records created" do
|
31
|
-
|
31
|
+
expect { subject.create_many([
|
32
32
|
{ :name => 'Alex', :company_id => 2, :integer_field => 4 },
|
33
33
|
{ :name => 'Aaron', :company_id => 3, :integer_field => 2 }])
|
34
|
-
}.
|
34
|
+
}.not_to raise_error
|
35
35
|
end
|
36
36
|
|
37
37
|
end # when try to create many records
|
@@ -39,7 +39,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
39
39
|
context "when try to find a record with the search term is id" do
|
40
40
|
|
41
41
|
it "returns employee name" do
|
42
|
-
subject.find(1).name.
|
42
|
+
expect(subject.find(1).name).to eq("Keith")
|
43
43
|
end
|
44
44
|
|
45
45
|
end # when try to find a record with the search term is id
|
@@ -47,7 +47,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
47
47
|
context "when try to find a record with the search term is name" do
|
48
48
|
|
49
49
|
it "returns employee name" do
|
50
|
-
subject.where(:name => 'Keith').first.name.
|
50
|
+
expect(subject.where(:name => 'Keith').first.name).to eq("Keith")
|
51
51
|
end
|
52
52
|
|
53
53
|
end # when try to find a record with the search term is name
|
@@ -55,7 +55,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
55
55
|
context "when try to find a record which is showing partition table" do
|
56
56
|
|
57
57
|
it "returns employee name" do
|
58
|
-
subject.from_partition(1).find(1).name.
|
58
|
+
expect(subject.from_partition(1).find(1).name).to eq("Keith")
|
59
59
|
end
|
60
60
|
|
61
61
|
end # when try to find a record which is showing partition table
|
@@ -64,7 +64,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
64
64
|
|
65
65
|
it "returns updated employee name" do
|
66
66
|
subject.update(1, :name => 'Kevin')
|
67
|
-
subject.find(1).name.
|
67
|
+
expect(subject.find(1).name).to eq("Kevin")
|
68
68
|
end
|
69
69
|
|
70
70
|
end # when try to update a record with id = 1
|
@@ -77,7 +77,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
77
77
|
:name => 'Alex'
|
78
78
|
}
|
79
79
|
} )
|
80
|
-
subject.find(1).name.
|
80
|
+
expect(subject.find(1).name).to eq("Alex")
|
81
81
|
end
|
82
82
|
|
83
83
|
it "returns updated employee name" do
|
@@ -93,7 +93,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
93
93
|
:where => '"#{table_name}.id = datatable.id"'
|
94
94
|
}
|
95
95
|
subject.update_many(rows, options)
|
96
|
-
subject.find(1).name.
|
96
|
+
expect(subject.find(1).name).to eq("Pit")
|
97
97
|
end
|
98
98
|
|
99
99
|
end # when try to update a record with update_many functions
|
@@ -102,7 +102,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
102
102
|
|
103
103
|
it "returns empty array" do
|
104
104
|
subject.delete(1)
|
105
|
-
subject.find(:all).
|
105
|
+
expect(subject.find(:all)).to eq([])
|
106
106
|
end
|
107
107
|
|
108
108
|
end # when try to delete a record with id = 1
|
@@ -110,8 +110,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
110
110
|
context "when try to create new record outside the range of partitions" do
|
111
111
|
|
112
112
|
it "raises ActiveRecord::StatementInvalid" do
|
113
|
-
|
114
|
-
}.
|
113
|
+
expect { subject.create_many([{ :name => 'Mark', :company_id => 13, :integer_field => 5 } ])
|
114
|
+
}.to raise_error(ActiveRecord::StatementInvalid)
|
115
115
|
end
|
116
116
|
|
117
117
|
end # when try to create new record outside the range of partitions
|
@@ -119,8 +119,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
119
119
|
context "when try to update a record outside the range of partitions" do
|
120
120
|
|
121
121
|
it "raises ActiveRecord::RecordNotFound" do
|
122
|
-
|
123
|
-
}.
|
122
|
+
expect { subject.update(100500, :name => 'Kevin')
|
123
|
+
}.to raise_error(ActiveRecord::RecordNotFound)
|
124
124
|
end
|
125
125
|
|
126
126
|
end # when try to update a record outside the range of partitions
|
@@ -128,8 +128,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
128
128
|
context "when try to find a record outside the range of partitions" do
|
129
129
|
|
130
130
|
it "raises ActiveRecord::StatementInvalid" do
|
131
|
-
|
132
|
-
}.
|
131
|
+
expect { subject.from_partition(8).find(1)
|
132
|
+
}.to raise_error(ActiveRecord::StatementInvalid)
|
133
133
|
end
|
134
134
|
|
135
135
|
end # when try to find a record outside the range of partitions
|
@@ -10,8 +10,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
10
10
|
context "when try to create one record" do
|
11
11
|
|
12
12
|
it "record created" do
|
13
|
-
|
14
|
-
}.
|
13
|
+
expect { subject.create(:name => 'Phil', :company_id => 3, :created_at => DATE_NOW + 1)
|
14
|
+
}.not_to raise_error
|
15
15
|
end
|
16
16
|
|
17
17
|
end # when try to create one record
|
@@ -19,10 +19,10 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
19
19
|
context "when try to create one record using new/save" do
|
20
20
|
|
21
21
|
it "record created" do
|
22
|
-
|
22
|
+
expect {
|
23
23
|
instance = subject.new(:name => 'Mike', :company_id => 1, :created_at => DATE_NOW + 1)
|
24
24
|
instance.save!
|
25
|
-
}.
|
25
|
+
}.not_to raise_error
|
26
26
|
end
|
27
27
|
|
28
28
|
end # when try to create one record using new/save
|
@@ -30,10 +30,10 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
30
30
|
context "when try to create many records" do
|
31
31
|
|
32
32
|
it "records created" do
|
33
|
-
|
33
|
+
expect { subject.create_many([
|
34
34
|
{ :name => 'Alex', :company_id => 2, :created_at => DATE_NOW + 1 },
|
35
35
|
{ :name => 'Aaron', :company_id => 3, :created_at => DATE_NOW + 1 }])
|
36
|
-
}.
|
36
|
+
}.not_to raise_error
|
37
37
|
end
|
38
38
|
|
39
39
|
end # when try to create many records
|
@@ -41,7 +41,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
41
41
|
context "when try to find a record with the search term is id" do
|
42
42
|
|
43
43
|
it "returns employee name" do
|
44
|
-
subject.find(1).name.
|
44
|
+
expect(subject.find(1).name).to eq("Keith")
|
45
45
|
end
|
46
46
|
|
47
47
|
end # when try to find a record with the search term is id
|
@@ -49,7 +49,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
49
49
|
context "when try to find a record with the search term is name" do
|
50
50
|
|
51
51
|
it "returns employee name" do
|
52
|
-
subject.where(:name => 'Keith').first.name.
|
52
|
+
expect(subject.where(:name => 'Keith').first.name).to eq("Keith")
|
53
53
|
end
|
54
54
|
|
55
55
|
end # when try to find a record with the search term is name
|
@@ -57,7 +57,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
57
57
|
context "when try to find a record with the search term is company_id" do
|
58
58
|
|
59
59
|
it "returns employee name" do
|
60
|
-
subject.where(:company_id => 1).first.name.
|
60
|
+
expect(subject.where(:company_id => 1).first.name).to eq("Keith")
|
61
61
|
end
|
62
62
|
|
63
63
|
end # when try to find a record with the search term is company_id
|
@@ -65,7 +65,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
65
65
|
context "when try to find a record which is showing partition table" do
|
66
66
|
|
67
67
|
it "returns employee name" do
|
68
|
-
subject.from_partition(DATE_NOW).find(1).name.
|
68
|
+
expect(subject.from_partition(DATE_NOW).find(1).name).to eq("Keith")
|
69
69
|
end
|
70
70
|
|
71
71
|
end # when try to find a record which is showing partition table
|
@@ -74,7 +74,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
74
74
|
|
75
75
|
it "returns updated employee name" do
|
76
76
|
subject.update(1, :name => 'Kevin')
|
77
|
-
subject.find(1).name.
|
77
|
+
expect(subject.find(1).name).to eq("Kevin")
|
78
78
|
end
|
79
79
|
|
80
80
|
end # when try to update a record with id = 1
|
@@ -89,7 +89,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
89
89
|
:created_at => DATE_NOW
|
90
90
|
}
|
91
91
|
} )
|
92
|
-
subject.find(1).name.
|
92
|
+
expect(subject.find(1).name).to eq("Alex")
|
93
93
|
end
|
94
94
|
|
95
95
|
it "returns updated employee name" do
|
@@ -104,7 +104,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
104
104
|
:where => '"#{table_name}.id = datatable.id"'
|
105
105
|
}
|
106
106
|
subject.update_many(rows, options)
|
107
|
-
subject.find(1).name.
|
107
|
+
expect(subject.find(1).name).to eq("Pit")
|
108
108
|
end
|
109
109
|
|
110
110
|
end # when try to update a record with update_many functions
|
@@ -113,7 +113,7 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
113
113
|
|
114
114
|
it "returns empty array" do
|
115
115
|
subject.delete(1)
|
116
|
-
subject.find(:all).
|
116
|
+
expect(subject.find(:all)).to eq([])
|
117
117
|
end
|
118
118
|
|
119
119
|
end # when try to delete a record with id = 1
|
@@ -121,8 +121,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
121
121
|
context "when try to create new record outside the range of partitions" do
|
122
122
|
|
123
123
|
it "raises ActiveRecord::StatementInvalid" do
|
124
|
-
|
125
|
-
}.
|
124
|
+
expect { subject.create_many([{ :created_at => DATE_NOW - 1.year, :company_id => 1 }])
|
125
|
+
}.to raise_error(ActiveRecord::StatementInvalid)
|
126
126
|
end
|
127
127
|
|
128
128
|
end # when try to create new record outside the range of partitions
|
@@ -130,8 +130,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
130
130
|
context "when try to update a record outside the range of partitions" do
|
131
131
|
|
132
132
|
it "raises ActiveRecord::StatementInvalid" do
|
133
|
-
|
134
|
-
}.
|
133
|
+
expect { subject.update(1, :name => 'Kevin', :created_at => DATE_NOW - 1.year)
|
134
|
+
}.to raise_error(ActiveRecord::StatementInvalid)
|
135
135
|
end
|
136
136
|
|
137
137
|
end # when try to update a record outside the range of partitions
|
@@ -139,8 +139,8 @@ shared_examples_for "check that basic operations with postgres works correctly f
|
|
139
139
|
context "when try to find a record outside the range of partitions" do
|
140
140
|
|
141
141
|
it "raises ActiveRecord::StatementInvalid" do
|
142
|
-
|
143
|
-
}.
|
142
|
+
expect { subject.from_partition(DATE_NOW - 1.year).find(1)
|
143
|
+
}.to raise_error(ActiveRecord::StatementInvalid)
|
144
144
|
end
|
145
145
|
|
146
146
|
end # when try to find a record outside the range of partitions
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: partitioned
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Keith Gabryelski
|
@@ -16,99 +15,101 @@ dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: jquery-rails
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
|
-
- -
|
19
|
+
- - ">="
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: '0'
|
24
22
|
type: :development
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
|
-
- -
|
26
|
+
- - ">="
|
30
27
|
- !ruby/object:Gem::Version
|
31
28
|
version: '0'
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: pg
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
|
-
- -
|
33
|
+
- - ">="
|
38
34
|
- !ruby/object:Gem::Version
|
39
35
|
version: '0'
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
|
-
- -
|
40
|
+
- - ">="
|
46
41
|
- !ruby/object:Gem::Version
|
47
42
|
version: '0'
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: bulk_data_methods
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
|
-
- -
|
47
|
+
- - ">="
|
54
48
|
- !ruby/object:Gem::Version
|
55
49
|
version: '0'
|
56
50
|
type: :runtime
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
|
-
- -
|
54
|
+
- - ">="
|
62
55
|
- !ruby/object:Gem::Version
|
63
56
|
version: '0'
|
64
57
|
- !ruby/object:Gem::Dependency
|
65
58
|
name: activerecord-redshift-adapter
|
66
59
|
requirement: !ruby/object:Gem::Requirement
|
67
|
-
none: false
|
68
60
|
requirements:
|
69
|
-
- -
|
61
|
+
- - ">="
|
70
62
|
- !ruby/object:Gem::Version
|
71
63
|
version: '0'
|
72
64
|
type: :runtime
|
73
65
|
prerelease: false
|
74
66
|
version_requirements: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
67
|
requirements:
|
77
|
-
- -
|
68
|
+
- - ">="
|
78
69
|
- !ruby/object:Gem::Version
|
79
70
|
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: activerecord
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.0'
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '3.0'
|
80
85
|
- !ruby/object:Gem::Dependency
|
81
86
|
name: rails
|
82
87
|
requirement: !ruby/object:Gem::Requirement
|
83
|
-
none: false
|
84
88
|
requirements:
|
85
|
-
- -
|
89
|
+
- - "~>"
|
86
90
|
- !ruby/object:Gem::Version
|
87
91
|
version: 3.2.8
|
88
92
|
type: :development
|
89
93
|
prerelease: false
|
90
94
|
version_requirements: !ruby/object:Gem::Requirement
|
91
|
-
none: false
|
92
95
|
requirements:
|
93
|
-
- -
|
96
|
+
- - "~>"
|
94
97
|
- !ruby/object:Gem::Version
|
95
98
|
version: 3.2.8
|
96
99
|
- !ruby/object:Gem::Dependency
|
97
100
|
name: rspec-rails
|
98
101
|
requirement: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
102
|
requirements:
|
101
|
-
- -
|
103
|
+
- - "~>"
|
102
104
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
105
|
+
version: '3.0'
|
104
106
|
type: :development
|
105
107
|
prerelease: false
|
106
108
|
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
none: false
|
108
109
|
requirements:
|
109
|
-
- -
|
110
|
+
- - "~>"
|
110
111
|
- !ruby/object:Gem::Version
|
111
|
-
version: '0'
|
112
|
+
version: '3.0'
|
112
113
|
description: A gem providing support for table partitioning in ActiveRecord. Support
|
113
114
|
is available for postgres and AWS RedShift databases. Other features include child
|
114
115
|
table management (creation and deletion) and bulk data creating and updating.
|
@@ -117,8 +118,9 @@ executables: []
|
|
117
118
|
extensions: []
|
118
119
|
extra_rdoc_files: []
|
119
120
|
files:
|
120
|
-
- .gitignore
|
121
|
-
- .rspec
|
121
|
+
- ".gitignore"
|
122
|
+
- ".rspec"
|
123
|
+
- ".travis.yml"
|
122
124
|
- Gemfile
|
123
125
|
- LICENSE
|
124
126
|
- PARTITIONING_EXPLAINED.txt
|
@@ -220,27 +222,26 @@ files:
|
|
220
222
|
homepage: http://github.com/fiksu/partitioned
|
221
223
|
licenses:
|
222
224
|
- New BSD License
|
225
|
+
metadata: {}
|
223
226
|
post_install_message:
|
224
227
|
rdoc_options: []
|
225
228
|
require_paths:
|
226
229
|
- lib
|
227
230
|
required_ruby_version: !ruby/object:Gem::Requirement
|
228
|
-
none: false
|
229
231
|
requirements:
|
230
|
-
- -
|
232
|
+
- - ">="
|
231
233
|
- !ruby/object:Gem::Version
|
232
234
|
version: '0'
|
233
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
|
-
none: false
|
235
236
|
requirements:
|
236
|
-
- -
|
237
|
+
- - ">="
|
237
238
|
- !ruby/object:Gem::Version
|
238
239
|
version: '0'
|
239
240
|
requirements: []
|
240
241
|
rubyforge_project:
|
241
|
-
rubygems_version:
|
242
|
+
rubygems_version: 2.4.3
|
242
243
|
signing_key:
|
243
|
-
specification_version:
|
244
|
+
specification_version: 4
|
244
245
|
summary: Postgres table partitioning support for ActiveRecord.
|
245
246
|
test_files:
|
246
247
|
- spec/dummy/.rspec
|