migration_tools 1.5.0 → 1.6.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.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/migration_tools/tasks.rb +18 -8
  3. metadata +6 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b4672873c0980176f5f8481054a9c7ddd3ebb9ad
4
- data.tar.gz: 1a548def35f56259a4b8b6ec15460dbcd4ea58a1
2
+ SHA256:
3
+ metadata.gz: 559ef9620f9ab388bc51427bb1d4a661d22c0ab07f440c4e1587dbd048186e5d
4
+ data.tar.gz: f46b6a2355613259abe718b355132dc62b3f3e537569907652ac12bab08f9ebc
5
5
  SHA512:
6
- metadata.gz: abcec27cea51bafd32f0d8ed358d02b98a447d1cf0034976f6106deb9ecbe90fa8cdadf9054aac1c3b2f0965d4cf6bd4c515e7d4f0b04b9c4b2c57688643ee71
7
- data.tar.gz: 19009d8b5b6e367084d4e443b3c256edd6b9e30ca78484826599f3b8e0ec103fd56860c1ea1322020e5095df67c1422e3d1c902955f313371c887e99368b178c
6
+ metadata.gz: 44a48c610a3565f332fe4c9e51b2275f8c7016efe72c53698010d0f89787d3316e3702816f8bf6574a80c287bdf757fb8fdd3f0daa39c69cb1de30cef546a340
7
+ data.tar.gz: 942b0e309ef6104c8f69f368f0f96ce9345a6ec13abc98fff7cd451786d8bdf6a9d6bed5bb8ce425aa348ea3693626d9aa03599dbff784dce8c8a2479a41590e
@@ -28,15 +28,25 @@ module MigrationTools
28
28
  end
29
29
 
30
30
  def migrator(target_version = nil)
31
- if ActiveRecord::VERSION::MAJOR > 3
32
- migrations = if defined?(::ActiveRecord::MigrationContext)
33
- ActiveRecord::MigrationContext.new(migrations_paths).migrations
34
- else
35
- ActiveRecord::Migrator.migrations(migrations_paths)
36
- end
37
- ActiveRecord::Migrator.new(:up, migrations, target_version)
31
+ if ActiveRecord::VERSION::MAJOR >= 6
32
+ migrate_up(ActiveRecord::MigrationContext.new(
33
+ migrations_paths,
34
+ ActiveRecord::SchemaMigration
35
+ ).migrations, target_version)
36
+ elsif ActiveRecord::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR == 2
37
+ migrate_up(ActiveRecord::MigrationContext.new(migrations_paths).migrations, target_version)
38
+ elsif ActiveRecord::VERSION::MAJOR > 3
39
+ migrate_up(ActiveRecord::Migrator.migrations(migrations_paths), target_version)
38
40
  else
39
- ActiveRecord::Migrator.new(:up, migrations_paths, target_version)
41
+ migrate_up(migrations_paths, target_version)
42
+ end
43
+ end
44
+
45
+ def migrate_up(migrations, target_version)
46
+ if ActiveRecord::VERSION::MAJOR >= 6
47
+ ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration, target_version)
48
+ else
49
+ ActiveRecord::Migrator.new(:up, migrations, target_version)
40
50
  end
41
51
  end
42
52
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: migration_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Morten Primdahl
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-11 00:00:00.000000000 Z
11
+ date: 2020-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 3.2.6
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '6.0'
22
+ version: '6.1'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 3.2.6
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '6.0'
32
+ version: '6.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -139,7 +139,7 @@ files:
139
139
  - lib/migration_tools/tasks.rb
140
140
  homepage: https://github.com/zendesk/migration_tools
141
141
  licenses:
142
- - Apache License Version 2.0
142
+ - Apache-2.0
143
143
  metadata: {}
144
144
  post_install_message:
145
145
  rdoc_options: []
@@ -156,8 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.6.14
159
+ rubygems_version: 3.0.3
161
160
  signing_key:
162
161
  specification_version: 4
163
162
  summary: Encourage migrations that do not require downtime