migration_tools 1.3.1 → 1.7.0

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: 12b49932fe409545d164d7cb198256b2486b298b
4
- data.tar.gz: 143860d5ed493dea62e247e17fa55f0e79c7f0b5
2
+ SHA256:
3
+ metadata.gz: 0c732ea88e26c0621508842c77ee2d539a2042c7b9b993587465d8e35db9cfab
4
+ data.tar.gz: b28ba6fa5efc44b25dba8460bb4e020ac3a83694cb937c813d528211601d426b
5
5
  SHA512:
6
- metadata.gz: 5383e68f3208176a38473a901b5cac684d322be1a48adc60415df1d35de2ba491851627e9909d1f702f58869791fe1b3636fa16ba065c421f26f974166a2b1c4
7
- data.tar.gz: 6025f1aff003f04b7f1d48c267d02ea62ef2c6bb1117c47c249a8df88f0e5a4d3a716076f7832a68785a8f25542089994508074ac01654b479b095a1300e9e0b
6
+ metadata.gz: 882f4ad3d1fb93fe07243ca9d77cc8efa6c1f030977ca8a29924d6d28ab395d3a1c891f082a53e2b48bd8e763fde08d2f3c032ff28acaf0fa2e8a3d59e98aa71
7
+ data.tar.gz: 56de39fc69b9b9b33f9fc26495ac0e3f6596f0e166e4479d445237b3c5a4b2410777479933965ed8f3d3e032d8479b232ed7df2fe9ae78b9929deb2047711ab6
@@ -10,7 +10,7 @@ module MigrationTools
10
10
  end
11
11
 
12
12
  def group
13
- return @group if @group
13
+ return @group if defined?(@group) && @group
14
14
 
15
15
  @group = ENV['GROUP'].to_s
16
16
  raise "Invalid group \"#{@group}\"" if !@group.empty? && !MIGRATION_GROUPS.member?(@group)
@@ -28,15 +28,28 @@ module MigrationTools
28
28
  end
29
29
 
30
30
  def migrator(target_version = nil)
31
- if ActiveRecord::VERSION::MAJOR > 3
32
- ActiveRecord::Migrator.new(:up, ActiveRecord::Migrator.migrations(migrations_paths), 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)
33
38
  else
34
- ActiveRecord::Migrator.new(:up, migrations_paths, target_version)
39
+ migrate_up(ActiveRecord::Migrator.migrations(migrations_paths), target_version)
40
+ end
41
+ end
42
+
43
+ def migrate_up(migrations, target_version)
44
+ if ActiveRecord::VERSION::MAJOR >= 6
45
+ ActiveRecord::Migrator.new(:up, migrations, ActiveRecord::SchemaMigration, target_version)
46
+ else
47
+ ActiveRecord::Migrator.new(:up, migrations, target_version)
35
48
  end
36
49
  end
37
50
 
38
51
  def pending_migrations
39
- return @pending_migrations if @pending_migrations
52
+ return @pending_migrations if defined?(@pending_migrations) && @pending_migrations
40
53
  @pending_migrations = migrator.pending_migrations
41
54
  @pending_migrations = @pending_migrations.select { |proxy| group.empty? || proxy.migration_group == group }
42
55
 
@@ -8,7 +8,7 @@ require 'migration_tools/tasks'
8
8
 
9
9
  module MigrationTools
10
10
  def self.forced?
11
- !!@forced
11
+ defined?(@forced) && !!@forced
12
12
  end
13
13
 
14
14
  def self.forced!
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.3.1
4
+ version: 1.7.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: 2016-01-26 00:00:00.000000000 Z
11
+ date: 2021-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.6
19
+ version: 4.2.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '6.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 3.2.6
29
+ version: 4.2.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '6.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -114,20 +114,6 @@ dependencies:
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
116
  version: '0'
117
- - !ruby/object:Gem::Dependency
118
- name: wwtd
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ">="
122
- - !ruby/object:Gem::Version
123
- version: '0'
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: '0'
131
117
  description: Rake tasks for Rails that add groups to migrations
132
118
  email: morten@zendesk.com
133
119
  executables: []
@@ -139,7 +125,7 @@ files:
139
125
  - lib/migration_tools/tasks.rb
140
126
  homepage: https://github.com/zendesk/migration_tools
141
127
  licenses:
142
- - Apache License Version 2.0
128
+ - Apache-2.0
143
129
  metadata: {}
144
130
  post_install_message:
145
131
  rdoc_options: []
@@ -156,8 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
156
142
  - !ruby/object:Gem::Version
157
143
  version: '0'
158
144
  requirements: []
159
- rubyforge_project:
160
- rubygems_version: 2.5.0
145
+ rubygems_version: 3.1.4
161
146
  signing_key:
162
147
  specification_version: 4
163
148
  summary: Encourage migrations that do not require downtime