zdm 1.0.7 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 325f45e849c39b9770c22c7ce892a41f153b6a30
4
- data.tar.gz: acb9889d53d320c1d9b74d570f2cfdbc18d2828f
3
+ metadata.gz: 57107f23e50a2c471f98eaf7d93e99247900985c
4
+ data.tar.gz: 3c994ebdaf1238794f67270a285e2d8bf9e21ee2
5
5
  SHA512:
6
- metadata.gz: 3a6efd42171ebfe5bc3f152cbc238cf06cfe53322e66d6198bd45dcd702ed5ce6b67446aaee5251f21c63c7de32ae3c7493357b5039457ce513fbd8c7040c813
7
- data.tar.gz: 6773233f8e943de709541d87ea7517b0a0d2d662564d27d5f235976086410a22ed845c2b723a5a5ab0e758fb1dc9183e95016cf0a7007d9d0aa501f6dda156f2
6
+ metadata.gz: d1afedadc7e2ef4e3c70897ecfe77d3a5234895eab7cde56a48a39b1cf44d44a08c25179a78fe000120caf829bcd3c61423e7047efc2452a0039632137db7490
7
+ data.tar.gz: d43ccdc6e57bf6a0d9761b64b8331810b8c183e077363d80afff7a783764752fab879f6b31e323256eb1148edc297ffd061b0af7d5420b0ec0d3eca8c2ba2133
@@ -1,15 +1,14 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.3.0
5
- - 2.4.0
4
+ - 2.4.3
5
+ - 2.5.1
6
6
 
7
7
  sudo: false
8
8
 
9
9
  gemfile:
10
- - gemfiles/4.1.gemfile
11
10
  - gemfiles/4.2.gemfile
12
- - gemfiles/5.0.gemfile
11
+ - gemfiles/5.2.gemfile
13
12
 
14
13
  services:
15
14
  - mysql
data/Appraisals CHANGED
@@ -1,9 +1,6 @@
1
- appraise '4.1' do
2
- gem 'activerecord', '4.1.15'
3
- end
4
1
  appraise '4.2' do
5
- gem 'activerecord', '4.2.8'
2
+ gem 'activerecord', '4.2.10'
6
3
  end
7
- appraise '5.0' do
8
- gem 'activerecord', '5.0.1'
4
+ appraise '5.2' do
5
+ gem 'activerecord', '5.2.0'
9
6
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "4.2.8"
5
+ gem "activerecord", "4.2.10"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -1,64 +1,66 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- zdm (1.0.7)
5
- activerecord (>= 4.0)
4
+ zdm (1.1.0)
5
+ activerecord (>= 4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (4.2.8)
11
- activesupport (= 4.2.8)
10
+ activemodel (4.2.10)
11
+ activesupport (= 4.2.10)
12
12
  builder (~> 3.1)
13
- activerecord (4.2.8)
14
- activemodel (= 4.2.8)
15
- activesupport (= 4.2.8)
13
+ activerecord (4.2.10)
14
+ activemodel (= 4.2.10)
15
+ activesupport (= 4.2.10)
16
16
  arel (~> 6.0)
17
- activesupport (4.2.8)
17
+ activesupport (4.2.10)
18
18
  i18n (~> 0.7)
19
19
  minitest (~> 5.1)
20
20
  thread_safe (~> 0.3, >= 0.3.4)
21
21
  tzinfo (~> 1.1)
22
- appraisal (2.1.0)
22
+ appraisal (2.2.0)
23
23
  bundler
24
24
  rake
25
25
  thor (>= 0.14.0)
26
26
  arel (6.0.4)
27
27
  builder (3.2.3)
28
+ concurrent-ruby (1.0.5)
28
29
  diff-lcs (1.3)
29
- i18n (0.8.1)
30
- minitest (5.10.1)
31
- mysql2 (0.4.5)
32
- rake (12.0.0)
33
- rspec (3.5.0)
34
- rspec-core (~> 3.5.0)
35
- rspec-expectations (~> 3.5.0)
36
- rspec-mocks (~> 3.5.0)
37
- rspec-core (3.5.4)
38
- rspec-support (~> 3.5.0)
39
- rspec-expectations (3.5.0)
30
+ i18n (0.9.5)
31
+ concurrent-ruby (~> 1.0)
32
+ minitest (5.11.3)
33
+ mysql2 (0.3.20)
34
+ rake (12.3.1)
35
+ rspec (3.7.0)
36
+ rspec-core (~> 3.7.0)
37
+ rspec-expectations (~> 3.7.0)
38
+ rspec-mocks (~> 3.7.0)
39
+ rspec-core (3.7.1)
40
+ rspec-support (~> 3.7.0)
41
+ rspec-expectations (3.7.0)
40
42
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.5.0)
42
- rspec-mocks (3.5.0)
43
+ rspec-support (~> 3.7.0)
44
+ rspec-mocks (3.7.0)
43
45
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.5.0)
45
- rspec-support (3.5.0)
46
- thor (0.19.4)
46
+ rspec-support (~> 3.7.0)
47
+ rspec-support (3.7.1)
48
+ thor (0.20.0)
47
49
  thread_safe (0.3.6)
48
- tzinfo (1.2.2)
50
+ tzinfo (1.2.5)
49
51
  thread_safe (~> 0.1)
50
52
 
51
53
  PLATFORMS
52
54
  ruby
53
55
 
54
56
  DEPENDENCIES
55
- activerecord (= 4.2.8)
57
+ activerecord (= 4.2.10)
56
58
  appraisal
57
- bundler (~> 1)
59
+ bundler
58
60
  mysql2
59
61
  rake
60
62
  rspec
61
63
  zdm!
62
64
 
63
65
  BUNDLED WITH
64
- 1.14.5
66
+ 1.16.2
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "5.0.1"
5
+ gem "activerecord", "5.2.0"
6
6
 
7
- gemspec :path => "../"
7
+ gemspec path: "../"
@@ -0,0 +1,64 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ zdm (1.1.0)
5
+ activerecord (>= 4.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (5.2.0)
11
+ activesupport (= 5.2.0)
12
+ activerecord (5.2.0)
13
+ activemodel (= 5.2.0)
14
+ activesupport (= 5.2.0)
15
+ arel (>= 9.0)
16
+ activesupport (5.2.0)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 0.7, < 2)
19
+ minitest (~> 5.1)
20
+ tzinfo (~> 1.1)
21
+ appraisal (2.2.0)
22
+ bundler
23
+ rake
24
+ thor (>= 0.14.0)
25
+ arel (9.0.0)
26
+ concurrent-ruby (1.0.5)
27
+ diff-lcs (1.3)
28
+ i18n (1.0.1)
29
+ concurrent-ruby (~> 1.0)
30
+ minitest (5.11.3)
31
+ mysql2 (0.5.1)
32
+ rake (12.3.1)
33
+ rspec (3.7.0)
34
+ rspec-core (~> 3.7.0)
35
+ rspec-expectations (~> 3.7.0)
36
+ rspec-mocks (~> 3.7.0)
37
+ rspec-core (3.7.1)
38
+ rspec-support (~> 3.7.0)
39
+ rspec-expectations (3.7.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.7.0)
42
+ rspec-mocks (3.7.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.7.0)
45
+ rspec-support (3.7.1)
46
+ thor (0.20.0)
47
+ thread_safe (0.3.6)
48
+ tzinfo (1.2.5)
49
+ thread_safe (~> 0.1)
50
+
51
+ PLATFORMS
52
+ ruby
53
+
54
+ DEPENDENCIES
55
+ activerecord (= 5.2.0)
56
+ appraisal
57
+ bundler
58
+ mysql2
59
+ rake
60
+ rspec
61
+ zdm!
62
+
63
+ BUNDLED WITH
64
+ 1.16.2
@@ -1,3 +1,3 @@
1
1
  module Zdm
2
- VERSION = '1.0.7'
2
+ VERSION = '1.1.0'
3
3
  end
data/lib/zdm.rb CHANGED
@@ -25,7 +25,11 @@ module Zdm
25
25
  end
26
26
 
27
27
  def tables_method
28
- ActiveRecord.version.to_s =~ /^5/ ? :data_sources : :tables
28
+ rails5? ? :data_sources : :tables
29
+ end
30
+
31
+ def rails5?
32
+ ActiveRecord.version.to_s =~ /^5/
29
33
  end
30
34
 
31
35
  BATCH_SIZE = 40_000
@@ -45,7 +45,7 @@ describe Zdm do
45
45
  stmt = conn.select_rows('show create table people')[0][1]
46
46
  expect(stmt.squish).to eq(<<-EOS.squish)
47
47
  CREATE TABLE `people` (
48
- `id` int(11) NOT NULL AUTO_INCREMENT,
48
+ `id` #{Zdm.rails5? ? 'bigint(20)' : 'int(11)'} NOT NULL AUTO_INCREMENT,
49
49
  `account_id` int(11) DEFAULT NULL,
50
50
  `name` varchar(99) COLLATE utf8_unicode_ci NOT NULL,
51
51
  `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
@@ -82,7 +82,7 @@ describe Zdm do
82
82
  stmt = conn.select_rows('show create table people')[0][1]
83
83
  expect(stmt.squish).to eq(<<-EOS.squish)
84
84
  CREATE TABLE `people` (
85
- `id` int(11) NOT NULL AUTO_INCREMENT,
85
+ `id` #{Zdm.rails5? ? 'bigint(20)' : 'int(11)'} NOT NULL AUTO_INCREMENT,
86
86
  `account_id` int(11) DEFAULT NULL,
87
87
  `name` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
88
88
  `code` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
@@ -171,5 +171,18 @@ describe Zdm do
171
171
 
172
172
  end
173
173
 
174
+ it 'cleans up archive tables' do
175
+ Zdm.change_table(:people) do |m|
176
+ m.add_column('test2', "varchar(1)")
177
+ end
174
178
 
179
+ Zdm.cleanup(before: 1.day.ago)
180
+ conn = ActiveRecord::Base.connection
181
+ tables = conn.send(Zdm.tables_method).select { |name| name.starts_with?('zdma_') }
182
+ expect(tables).to_not be_empty
183
+
184
+ Zdm.cleanup(before: 1.day.from_now)
185
+ tables = conn.send(Zdm.tables_method).select { |name| name.starts_with?('zdma_') }
186
+ expect(tables).to be_empty
187
+ end
175
188
  end
@@ -4,8 +4,8 @@ require 'version'
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'zdm'
6
6
  s.version = Zdm::VERSION
7
- s.authors = ['ITRP Institute, Inc.']
8
- s.email = ['support@itrp.com']
7
+ s.authors = ['4me, Inc.']
8
+ s.email = ['support@4me.com']
9
9
  s.description = %q{Zero Downtime Migrator of mysql compatible databases}
10
10
  s.summary = %q{Zero Downtime Migrator for mysql in ruby}
11
11
  s.homepage = 'https://github.com/itrp/zdm'
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
16
16
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
17
17
  s.require_paths = ['lib']
18
18
 
19
- s.add_dependency 'activerecord', '>= 4.0'
19
+ s.add_dependency 'activerecord', '>= 4.2'
20
20
 
21
- s.add_development_dependency 'bundler', '~> 1'
21
+ s.add_development_dependency 'bundler'
22
22
  s.add_development_dependency 'rake'
23
23
  s.add_development_dependency 'rspec'
24
24
  s.add_development_dependency 'mysql2'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - ITRP Institute, Inc.
7
+ - 4me, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-30 00:00:00.000000000 Z
11
+ date: 2018-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: '4.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: '4.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1'
33
+ version: '0'
34
34
  type: :development
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: '1'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -96,7 +96,7 @@ dependencies:
96
96
  version: '0'
97
97
  description: Zero Downtime Migrator of mysql compatible databases
98
98
  email:
99
- - support@itrp.com
99
+ - support@4me.com
100
100
  executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
@@ -108,12 +108,10 @@ files:
108
108
  - LICENSE
109
109
  - README.md
110
110
  - Rakefile
111
- - gemfiles/4.1.gemfile
112
- - gemfiles/4.1.gemfile.lock
113
111
  - gemfiles/4.2.gemfile
114
112
  - gemfiles/4.2.gemfile.lock
115
- - gemfiles/5.0.gemfile
116
- - gemfiles/5.0.gemfile.lock
113
+ - gemfiles/5.2.gemfile
114
+ - gemfiles/5.2.gemfile.lock
117
115
  - lib/version.rb
118
116
  - lib/zdm.rb
119
117
  - spec/database.yml
@@ -140,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
138
  version: '0'
141
139
  requirements: []
142
140
  rubyforge_project:
143
- rubygems_version: 2.6.8
141
+ rubygems_version: 2.6.14
144
142
  signing_key:
145
143
  specification_version: 4
146
144
  summary: Zero Downtime Migrator for mysql in ruby
@@ -1,7 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "4.1.15"
6
-
7
- gemspec :path => "../"
@@ -1,66 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- zdm (1.0.7)
5
- activerecord (>= 4.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activemodel (4.1.15)
11
- activesupport (= 4.1.15)
12
- builder (~> 3.1)
13
- activerecord (4.1.15)
14
- activemodel (= 4.1.15)
15
- activesupport (= 4.1.15)
16
- arel (~> 5.0.0)
17
- activesupport (4.1.15)
18
- i18n (~> 0.6, >= 0.6.9)
19
- json (~> 1.7, >= 1.7.7)
20
- minitest (~> 5.1)
21
- thread_safe (~> 0.1)
22
- tzinfo (~> 1.1)
23
- appraisal (2.1.0)
24
- bundler
25
- rake
26
- thor (>= 0.14.0)
27
- arel (5.0.1.20140414130214)
28
- builder (3.2.3)
29
- diff-lcs (1.3)
30
- i18n (0.8.1)
31
- json (1.8.6)
32
- minitest (5.10.1)
33
- mysql2 (0.3.20)
34
- rake (12.0.0)
35
- rspec (3.5.0)
36
- rspec-core (~> 3.5.0)
37
- rspec-expectations (~> 3.5.0)
38
- rspec-mocks (~> 3.5.0)
39
- rspec-core (3.5.4)
40
- rspec-support (~> 3.5.0)
41
- rspec-expectations (3.5.0)
42
- diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.5.0)
44
- rspec-mocks (3.5.0)
45
- diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.5.0)
47
- rspec-support (3.5.0)
48
- thor (0.19.4)
49
- thread_safe (0.3.6)
50
- tzinfo (1.2.2)
51
- thread_safe (~> 0.1)
52
-
53
- PLATFORMS
54
- ruby
55
-
56
- DEPENDENCIES
57
- activerecord (= 4.1.15)
58
- appraisal
59
- bundler (~> 1)
60
- mysql2
61
- rake
62
- rspec
63
- zdm!
64
-
65
- BUNDLED WITH
66
- 1.14.5
@@ -1,63 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- zdm (1.0.7)
5
- activerecord (>= 4.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activemodel (5.0.1)
11
- activesupport (= 5.0.1)
12
- activerecord (5.0.1)
13
- activemodel (= 5.0.1)
14
- activesupport (= 5.0.1)
15
- arel (~> 7.0)
16
- activesupport (5.0.1)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (~> 0.7)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- appraisal (2.1.0)
22
- bundler
23
- rake
24
- thor (>= 0.14.0)
25
- arel (7.1.4)
26
- concurrent-ruby (1.0.4)
27
- diff-lcs (1.3)
28
- i18n (0.8.1)
29
- minitest (5.10.1)
30
- mysql2 (0.4.5)
31
- rake (12.0.0)
32
- rspec (3.5.0)
33
- rspec-core (~> 3.5.0)
34
- rspec-expectations (~> 3.5.0)
35
- rspec-mocks (~> 3.5.0)
36
- rspec-core (3.5.4)
37
- rspec-support (~> 3.5.0)
38
- rspec-expectations (3.5.0)
39
- diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.5.0)
41
- rspec-mocks (3.5.0)
42
- diff-lcs (>= 1.2.0, < 2.0)
43
- rspec-support (~> 3.5.0)
44
- rspec-support (3.5.0)
45
- thor (0.19.4)
46
- thread_safe (0.3.6)
47
- tzinfo (1.2.2)
48
- thread_safe (~> 0.1)
49
-
50
- PLATFORMS
51
- ruby
52
-
53
- DEPENDENCIES
54
- activerecord (= 5.0.1)
55
- appraisal
56
- bundler (~> 1)
57
- mysql2
58
- rake
59
- rspec
60
- zdm!
61
-
62
- BUNDLED WITH
63
- 1.14.5