convergence 0.1.6 → 0.1.7

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: 51bbaf475864ac4661a6baea58bbdee8ba529ae6
4
- data.tar.gz: 17b2d9bbf3ef7f165cfa727e8fb886158c3dcd78
3
+ metadata.gz: cdf6c82541efe1895f0e5346134025b161376199
4
+ data.tar.gz: cb67cd83c49cb3ece78f0b639c9cde1882f7b59e
5
5
  SHA512:
6
- metadata.gz: f6e46bd1a8d88086fd0ffea8dd0159b2b3cd7c629e9d94adfae4714332f29ef4aaa0de87e612b940c6757a8d17abc7bac623cd9cb89448c787336729ce3e950c
7
- data.tar.gz: 2f43200535d9cf95f79e1f5315835cf7ccc40f8eac6f7e3baf29339a64540a32317b2e3e5c1f0b5612b0bd72d13666fb664021c4923007256c2cb886797bb831
6
+ metadata.gz: 3d8799c6997f90911cb6e2197f7b091442a93b0015b3baf1420ce355b6541f6a87fd109e75ece21bd153cc1e8770b32398c6ad85b34f4c7c1bad17031daf8b3b
7
+ data.tar.gz: 2a730487ee76fda3a585c6e62224afbd192c9b86d4942ee56cb21b2cae834aed90fc74b5b47b221104c6a71cdc31231b0ac27c5fccf4274e0b1e1484546a9ef3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- convergence (0.1.6)
4
+ convergence (0.1.7)
5
5
  diff-lcs
6
6
  diffy
7
7
  mysql2
@@ -36,7 +36,7 @@ GEM
36
36
  rb-inotify (>= 0.9)
37
37
  lumberjack (1.0.9)
38
38
  method_source (0.8.2)
39
- mysql2 (0.4.2)
39
+ mysql2 (0.4.4)
40
40
  parser (2.2.0.pre.5)
41
41
  ast (>= 1.1, < 3.0)
42
42
  slop (~> 3.4, >= 3.4.5)
@@ -88,4 +88,4 @@ DEPENDENCIES
88
88
  rubocop
89
89
 
90
90
  BUNDLED WITH
91
- 1.10.6
91
+ 1.12.5
data/README.md CHANGED
@@ -144,7 +144,7 @@ You need to make database.yml to access your database.
144
144
 
145
145
  ```
146
146
  $ cat database.yml
147
- dapter: mysql
147
+ adapter: mysql
148
148
  database: convergence_test
149
149
  host: 127.0.0.1
150
150
  username: root
@@ -1,6 +1,8 @@
1
1
  require 'diff/lcs'
2
2
 
3
3
  class Convergence::Diff
4
+ CASE_SENSITIVE_COLUMNS = %i(default comment)
5
+
4
6
  def diff(from_database, to_database)
5
7
  delta = {}
6
8
  from_database = {} if from_database.nil?
@@ -76,12 +78,12 @@ class Convergence::Diff
76
78
  to_column_option_with_type = (from_column.options.map { |k, _v| { k => nil } }.reduce { |a, e| a.merge(e) } || {})
77
79
  .merge(to_column.options)
78
80
  .merge(type: to_column.type)
79
- .map { |k, v| [k, v.to_s.downcase] }
81
+ .map { |k, v| [k, case_sensitive_column?(k) ? v.to_s : v.to_s.downcase] }
80
82
  .to_a
81
83
  from_column_option_with_type = from_column
82
84
  .options
83
85
  .merge(type: from_column.type)
84
- .map { |k, v| [k, v.to_s.downcase] }
86
+ .map { |k, v| [k, case_sensitive_column?(k) ? v.to_s : v.to_s.downcase] }
85
87
  .to_a
86
88
  { column_name => Hash[(to_column_option_with_type - from_column_option_with_type)] }
87
89
  end
@@ -158,4 +160,8 @@ class Convergence::Diff
158
160
  def removed_all_columns?(from_table, diff)
159
161
  from_table.columns.each_key.all? { |name| diff[:remove_column].each_key.include?(name) }
160
162
  end
163
+
164
+ def case_sensitive_column?(column)
165
+ CASE_SENSITIVE_COLUMNS.include?(column)
166
+ end
161
167
  end
@@ -1,3 +1,3 @@
1
1
  module Convergence
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: convergence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinsuke Nishio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-22 00:00:00.000000000 Z
11
+ date: 2016-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
248
  version: '0'
249
249
  requirements: []
250
250
  rubyforge_project:
251
- rubygems_version: 2.4.5
251
+ rubygems_version: 2.5.1
252
252
  signing_key:
253
253
  specification_version: 4
254
254
  summary: DB Schema management tool