data_migrate 9.1.3 → 9.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +1 -1
  3. data/.gitignore +0 -1
  4. data/Appraisals +4 -4
  5. data/Changelog.md +3 -12
  6. data/Gemfile.lock +148 -0
  7. data/README.md +3 -3
  8. data/data_migrate.gemspec +1 -1
  9. data/gemfiles/rails_6.1.gemfile +1 -1
  10. data/gemfiles/rails_6.1.gemfile.lock +227 -0
  11. data/gemfiles/rails_7.0.gemfile +1 -1
  12. data/gemfiles/rails_7.0.gemfile.lock +229 -0
  13. data/gemfiles/{rails_6.0.gemfile → rails_7.1.gemfile} +1 -1
  14. data/gemfiles/rails_7.1.gemfile.lock +262 -0
  15. data/lib/data_migrate/data_migrator.rb +11 -23
  16. data/lib/data_migrate/data_schema.rb +1 -1
  17. data/lib/data_migrate/data_schema_migration.rb +24 -7
  18. data/lib/data_migrate/database_tasks.rb +17 -18
  19. data/lib/data_migrate/migration_context.rb +11 -8
  20. data/lib/data_migrate/rails_helper.rb +79 -0
  21. data/lib/data_migrate/schema_dumper.rb +1 -1
  22. data/lib/data_migrate/schema_migration.rb +5 -4
  23. data/lib/data_migrate/status_service.rb +3 -3
  24. data/lib/data_migrate/tasks/data_migrate_tasks.rb +3 -3
  25. data/lib/data_migrate/version.rb +1 -1
  26. data/lib/data_migrate.rb +1 -1
  27. data/spec/data_migrate/data_migrator_spec.rb +16 -13
  28. data/spec/data_migrate/data_schema_migration_spec.rb +25 -8
  29. data/spec/data_migrate/data_spec.rb +1 -1
  30. data/spec/data_migrate/database_tasks_spec.rb +34 -18
  31. data/spec/data_migrate/migration_context_spec.rb +15 -8
  32. data/spec/data_migrate/schema_dumper_spec.rb +6 -3
  33. data/spec/data_migrate/schema_migration_spec.rb +13 -6
  34. data/spec/data_migrate/status_service_spec.rb +6 -3
  35. data/spec/data_migrate/tasks/data_migrate_tasks_spec.rb +8 -8
  36. data/spec/db/data/20091231235959_some_name.rb +1 -1
  37. data/spec/db/data/20171231235959_super_update.rb +1 -1
  38. data/spec/db/migrate/20131111111111_late_migration.rb +1 -1
  39. data/spec/db/migrate/20202020202011_db_migration.rb +1 -1
  40. metadata +13 -10
  41. data/lib/data_migrate/legacy_migrator.rb +0 -22
  42. data/spec/data_migrate/legacy_migrator_spec.rb +0 -38
@@ -1,4 +1,4 @@
1
- class SuperUpdate < ActiveRecord::Migration[6.0]
1
+ class SuperUpdate < ActiveRecord::Migration[6.1]
2
2
  def up
3
3
  puts "Doing SuperUpdate"
4
4
  end
@@ -1,4 +1,4 @@
1
- class LateMigration < ActiveRecord::Migration[6.0]
1
+ class LateMigration < ActiveRecord::Migration[6.1]
2
2
  def up
3
3
  puts "Doing schema LateMigration"
4
4
  end
@@ -1,4 +1,4 @@
1
- class DbMigration < ActiveRecord::Migration[6.0]
1
+ class DbMigration < ActiveRecord::Migration[6.1]
2
2
  def up
3
3
  puts "Doing schema migration"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: data_migrate
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.1.3
4
+ version: 9.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew J Vargo
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-09-28 00:00:00.000000000 Z
13
+ date: 2023-10-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -18,28 +18,28 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '6.0'
21
+ version: '6.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '6.0'
28
+ version: '6.1'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: railties
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: '6.0'
35
+ version: '6.1'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '6.0'
42
+ version: '6.1'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: appraisal
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -201,14 +201,18 @@ files:
201
201
  - Appraisals
202
202
  - Changelog.md
203
203
  - Gemfile
204
+ - Gemfile.lock
204
205
  - Gemfile.rails6.1
205
206
  - LICENSE
206
207
  - README.md
207
208
  - Rakefile
208
209
  - data_migrate.gemspec
209
- - gemfiles/rails_6.0.gemfile
210
210
  - gemfiles/rails_6.1.gemfile
211
+ - gemfiles/rails_6.1.gemfile.lock
211
212
  - gemfiles/rails_7.0.gemfile
213
+ - gemfiles/rails_7.0.gemfile.lock
214
+ - gemfiles/rails_7.1.gemfile
215
+ - gemfiles/rails_7.1.gemfile.lock
212
216
  - lib/capistrano/data_migrate.rb
213
217
  - lib/capistrano/data_migrate/migrate.rb
214
218
  - lib/data_migrate.rb
@@ -217,8 +221,8 @@ files:
217
221
  - lib/data_migrate/data_schema.rb
218
222
  - lib/data_migrate/data_schema_migration.rb
219
223
  - lib/data_migrate/database_tasks.rb
220
- - lib/data_migrate/legacy_migrator.rb
221
224
  - lib/data_migrate/migration_context.rb
225
+ - lib/data_migrate/rails_helper.rb
222
226
  - lib/data_migrate/railtie.rb
223
227
  - lib/data_migrate/schema_dumper.rb
224
228
  - lib/data_migrate/schema_migration.rb
@@ -235,7 +239,6 @@ files:
235
239
  - spec/data_migrate/data_schema_migration_spec.rb
236
240
  - spec/data_migrate/data_spec.rb
237
241
  - spec/data_migrate/database_tasks_spec.rb
238
- - spec/data_migrate/legacy_migrator_spec.rb
239
242
  - spec/data_migrate/migration.rb
240
243
  - spec/data_migrate/migration_context_spec.rb
241
244
  - spec/data_migrate/schema_dumper_spec.rb
@@ -274,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
277
  - !ruby/object:Gem::Version
275
278
  version: '0'
276
279
  requirements: []
277
- rubygems_version: 3.4.19
280
+ rubygems_version: 3.4.10
278
281
  signing_key:
279
282
  specification_version: 4
280
283
  summary: Rake tasks to migrate data alongside schema changes.
@@ -1,22 +0,0 @@
1
- module DataMigrate
2
- class LegacyMigrator
3
- def initialize(migrations_paths = "db/data")
4
- @migrations_paths = migrations_paths || "db/data"
5
- end
6
-
7
- def migrate
8
- dates =
9
- DataMigrate::DataMigrator.migrations(@migrations_paths).collect(&:version)
10
- legacy = ActiveRecord::SchemaMigration.where(version: dates)
11
- legacy.each do |v|
12
- begin
13
- version = v.version
14
- puts "Creating #{version} in data schema"
15
- DataMigrate::DataSchemaMigration.create(version: version)
16
- rescue ActiveRecord::RecordNotUnique
17
- nil
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "spec_helper"
4
-
5
- describe DataMigrate::LegacyMigrator do
6
- let(:context) {
7
- DataMigrate::MigrationContext.new("spec/db/data")
8
- }
9
-
10
- before do
11
- ActiveRecord::SchemaMigration.create_table
12
- DataMigrate::DataSchemaMigration.create_table
13
- end
14
-
15
- after do
16
- ActiveRecord::Migration.drop_table("data_migrations") rescue nil
17
- ActiveRecord::Migration.drop_table("schema_migrations") rescue nil
18
- end
19
-
20
- it "migrate legacy migrations to be in correct table" do
21
- # simulate creation of legacy data migration when
22
- # it was recorded in schema table
23
- ActiveRecord::SchemaMigration.create(version: "20091231235959")
24
-
25
- # create one migration in correct place
26
- DataMigrate::DataSchemaMigration.create(version: "20171231235959")
27
-
28
- migrated = DataMigrate::DataMigrator.new(:up, []).load_migrated
29
- expect(migrated.count).to eq 1
30
-
31
- DataMigrate::LegacyMigrator.new("spec/db/data").migrate
32
-
33
- # after migacy migrator has been run, we should have records
34
- # of both migrations
35
- migrated = DataMigrate::DataMigrator .new(:up, []).load_migrated
36
- expect(migrated.count).to eq 2
37
- end
38
- end