schema_plus_indexes 0.2.0 → 0.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
2
  SHA1:
3
- metadata.gz: df1b409660d57bf87cb28e5b46ff7f4121d9b4db
4
- data.tar.gz: afb439a86e897f10b6bab354f5f0643d39f3b7f8
3
+ metadata.gz: 3121eeeae9f409e4f1d0c4a379e39de02a8806a0
4
+ data.tar.gz: f2ce9696d738ba265d3277bd8d8ca13bd379a981
5
5
  SHA512:
6
- metadata.gz: 2cf73bec7659a3e32a047fa092352ca1a9fd3de1d3fb3c78bdeba59459413b62550771aa6e7cad2198fc255ca56d995c85826a1b14f2c471e4e85fa2c3d0dc4c
7
- data.tar.gz: e14c80880a1746ce6d03108b7566126682d2d570adc37144dce9b6fdab8f5aa2379d563660f91c41269f3be0b3e977db5b9b0dc2a59285bdbae894cfedd13470
6
+ metadata.gz: a2edcfebaa5b39ab374348071042afe30773e3338f35669f7075cc472ac8b1788071140650c241d6b3423b10fd933cda245878ecc8c24bd27eb1317f71428165
7
+ data.tar.gz: d4713ba88555e4ee3982adf7cc5bed6e1e88c479b0efc8c642d0b82b88692f6865e7a19b866ad790569b4ee45d85c479f8af68c714a5865e73114de15bc21838
data/README.md CHANGED
@@ -112,6 +112,10 @@ schema_plus_indexes is tested on
112
112
 
113
113
  ## History
114
114
 
115
+ ### v0.2.1
116
+
117
+ * Upgrade to schema_plus_core 1.0 and conform
118
+
115
119
  ### v0.2.0
116
120
 
117
121
  * Prevent down :change migrations from failing due to trying to remove non-existent indexes
@@ -1,3 +1,3 @@
1
1
  eval File.read File.expand_path('../../Gemfile.base', __FILE__)
2
2
 
3
- gem "activerecord", "~> 4.2.0"
3
+ gem "activerecord", "~> 4.2.6"
@@ -2,9 +2,9 @@ require "pathname"
2
2
  eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding)
3
3
 
4
4
  platform :ruby do
5
- gem "mysql2"
5
+ gem "mysql2", '>= 0.3.18', '< 0.5'
6
6
  end
7
7
 
8
8
  platform :jruby do
9
9
  gem 'activerecord-jdbcmysql-adapter'
10
- end
10
+ end
@@ -12,12 +12,12 @@ module SchemaPlus::Indexes
12
12
 
13
13
  # first check for a single-column index
14
14
  if (index = env.table.indexes.find(&its.columns == [column.name]))
15
- column.add_option column_index(env, column, index)
15
+ column.options[:index] = index_options(env, column, index)
16
16
  env.table.indexes.delete(index)
17
17
 
18
18
  # then check for the first of a multi-column index
19
19
  elsif (index = env.table.indexes.find(&its.columns.first == column.name))
20
- column.add_option column_index(env, column, index)
20
+ column.options[:index] = index_options(env, column, index)
21
21
  env.table.indexes.delete(index)
22
22
  end
23
23
 
@@ -25,12 +25,11 @@ module SchemaPlus::Indexes
25
25
 
26
26
  end
27
27
 
28
- def column_index(env, column, index)
29
- parts = []
30
- parts << "name: #{index.name.inspect}"
31
- parts << "with: #{(index.columns - [column.name]).inspect}" if index.columns.length > 1
32
- parts << index.options unless index.options.blank?
33
- "index: {#{parts.join(', ')}}"
28
+ def index_options(env, column, index)
29
+ options = {}
30
+ options[:name] = index.name
31
+ options[:with] = (index.columns - [column.name]) if index.columns.length > 1
32
+ options.merge index.options
34
33
  end
35
34
  end
36
35
  end
@@ -1,5 +1,5 @@
1
1
  module SchemaPlus
2
2
  module Indexes
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -18,12 +18,12 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency "activerecord", "~> 4.2"
21
- gem.add_dependency "schema_plus_core", "~> 0.1"
21
+ gem.add_dependency "schema_plus_core", "~> 1.0"
22
22
 
23
23
  gem.add_development_dependency "bundler", "~> 1.7"
24
24
  gem.add_development_dependency "rake", "~> 10.0"
25
25
  gem.add_development_dependency "rspec", "~> 3.0.0"
26
- gem.add_development_dependency "schema_dev", "~> 3.3"
26
+ gem.add_development_dependency "schema_dev", "~> 3.6"
27
27
  gem.add_development_dependency "simplecov"
28
28
  gem.add_development_dependency "simplecov-gem-profile"
29
29
  end
@@ -43,7 +43,7 @@ describe "Schema dump" do
43
43
 
44
44
  it "should include in-table index definition" do
45
45
  with_index Post, :user_id do
46
- expect(dump_posts).to match(/"user_id",.*index:/)
46
+ expect(dump_posts).to match(/"user_id",.*:index=>/)
47
47
  end
48
48
  end
49
49
 
@@ -55,19 +55,19 @@ describe "Schema dump" do
55
55
 
56
56
  it "should include index name" do
57
57
  with_index Post, :user_id, :name => "custom_name" do
58
- expect(dump_posts).to match(/"user_id",.*index:.*name: "custom_name"/)
58
+ expect(dump_posts).to match(/"user_id",.*:index=>.*:name=>"custom_name"/)
59
59
  end
60
60
  end
61
61
 
62
62
  it "should define unique index" do
63
63
  with_index Post, :user_id, :name => "posts_user_id_index", :unique => true do
64
- expect(dump_posts).to match(/"user_id",.*index:.*name: "posts_user_id_index", unique: true/)
64
+ expect(dump_posts).to match(/"user_id",.*:index=>.*:name=>"posts_user_id_index", :unique=>true/)
65
65
  end
66
66
  end
67
67
 
68
68
  it "should include index order", :mysql => :skip do
69
69
  with_index Post, [:user_id, :first_comment_id, :short_id], :order => { :user_id => :asc, :first_comment_id => :desc } do
70
- expect(dump_posts).to match(/"user_id".*index: {.*with: \["first_comment_id", "short_id"\],.*order: {"user_id"=>:asc, "first_comment_id"=>:desc, "short_id"=>:asc}/)
70
+ expect(dump_posts).to match(/"user_id".*:index=>{.*:with=>\["first_comment_id", "short_id"\],.*:order=>{"user_id"=>:asc, "first_comment_id"=>:desc, "short_id"=>:asc}/)
71
71
  end
72
72
  end
73
73
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_plus_indexes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.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: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2016-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '3.3'
89
+ version: '3.6'
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.3'
96
+ version: '3.6'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: simplecov
99
99
  requirement: !ruby/object:Gem::Requirement