schema_plus_core 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3e8e79d68457a1e4ce6d7ff39807855e36cd2e9a
4
- data.tar.gz: 5155f4e1926b764f3170c699eafb3e4cb789ecf9
2
+ SHA256:
3
+ metadata.gz: dfc1ffe7f432c8e74c488bcf10f95dbe2f2050a7d2b8981a90b154689a635965
4
+ data.tar.gz: 01dc5cb4e3dccaacd7c9fe1eb800dab7646fc001e82ec12bcd1cac90b0d47db3
5
5
  SHA512:
6
- metadata.gz: cb5a7d23d7ab4f2fbb0c750386f4c5b721f9d8f4f72331290368569bbeba44e0da640c56b30c96728aa410e81bf9b39997fa9c214b835ca3e07ed62519da604e
7
- data.tar.gz: 6e4369733968625498dcf83a73748640f2af0e9456fd9a2b045bc9052977850b3b597f1d00240af92001e163370e3556480d853103768a52ead5e4ed5b746ae7
6
+ metadata.gz: 675a1ccf6531d7bacc97e1354772c77690fa2ba956402f8054bdb47e60f8c32363a9c54287acf24019b66a74270ac3e39d06a8d8d803f57827d6a2f7eee68d6d
7
+ data.tar.gz: '09513084a2643ec5a9a1bb30a9f6aaa308f3e2ed6dc065067b9f2bcec956ef954a9db19ca20ec51cce17794f3a5e4b027bc58b2d44abfbd11c8ffbc1085662af'
data/README.md CHANGED
@@ -444,6 +444,7 @@ SchemaPlus::Core provides a state object and of callbacks to various phases of t
444
444
 
445
445
  ## Release Notes
446
446
 
447
+ * 2.2.1 Fixed expression index handling in AR5.x.
447
448
  * 2.2.0 Added AR5.2 support. Thanks to [@jeremyyap](https://github.com/jeremyyap)
448
449
  * 2.1.1 Bug fix: Don't lose habtm options. Thanks to [@iagopiimenta ](https://github.com/iagopiimenta)
449
450
  * 2.1.0 Added AR5.1 support. Thanks to [@iagopiimenta ](https://github.com/iagopiimenta)
@@ -35,6 +35,24 @@ module SchemaPlus
35
35
  end
36
36
  end
37
37
 
38
+ # replaced version to handle array of columns with expressions
39
+ def quoted_columns_for_index(column_names, **options)
40
+ output_columns = []
41
+
42
+ column_names.each do |column|
43
+ if column.is_a?(String) && column.include?('(')
44
+ output_columns << column
45
+ else
46
+ quoted = {column.to_sym => quote_column_name(column).dup}
47
+ output_columns.concat add_options_for_index_columns(quoted, options).values
48
+ end
49
+ end
50
+
51
+ output_columns
52
+ end
53
+ private :quoted_columns_for_index
54
+
55
+
38
56
  module SchemaCreation
39
57
 
40
58
  def add_column_options!(sql, options)
@@ -1,5 +1,5 @@
1
1
  module SchemaPlus
2
2
  module Core
3
- VERSION = "2.2.0"
3
+ VERSION = "2.2.1"
4
4
  end
5
5
  end
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
24
24
 
25
25
  gem.add_development_dependency "bundler", "~> 1.7"
26
26
  gem.add_development_dependency "rake", "~> 10.0"
27
- gem.add_development_dependency "rspec", "~> 3.0.0"
27
+ gem.add_development_dependency "rspec", "~> 3.0"
28
28
  gem.add_development_dependency "rspec-given"
29
29
  gem.add_development_dependency "schema_dev", "~> 3.11"
30
30
  gem.add_development_dependency "simplecov"
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe SchemaMonkey::Middleware::Migration::Index do
4
+
5
+ let(:migration) {::ActiveRecord::Migration}
6
+ let(:connection) {::ActiveRecord::Base.connection}
7
+
8
+ describe '#add_index' do
9
+ before(:each) do
10
+ migration.create_table :things, :force => true do |t|
11
+ t.string :test_column
12
+ end
13
+ end
14
+
15
+ context "when add an index with an expression", postgresql: :only do
16
+ it 'should create the index successfully' do
17
+ migration.add_index 'things', 'lower(test_column)'
18
+ expect(connection.indexes(:things).first.columns).to eq('lower((test_column)::text)')
19
+ end
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_plus_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ronen barzel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-14 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 3.0.0
89
+ version: '3.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 3.0.0
96
+ version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec-given
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -210,6 +210,7 @@ files:
210
210
  - schema_plus_core.gemspec
211
211
  - spec/column_spec.rb
212
212
  - spec/dumper_spec.rb
213
+ - spec/index_spec.rb
213
214
  - spec/middleware_spec.rb
214
215
  - spec/spec_helper.rb
215
216
  - spec/sql_struct_spec.rb
@@ -235,13 +236,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
236
  version: '0'
236
237
  requirements: []
237
238
  rubyforge_project:
238
- rubygems_version: 2.5.1
239
+ rubygems_version: 2.7.6
239
240
  signing_key:
240
241
  specification_version: 4
241
242
  summary: Provides an internal extension API to ActiveRecord
242
243
  test_files:
243
244
  - spec/column_spec.rb
244
245
  - spec/dumper_spec.rb
246
+ - spec/index_spec.rb
245
247
  - spec/middleware_spec.rb
246
248
  - spec/spec_helper.rb
247
249
  - spec/sql_struct_spec.rb