data_migrate 9.4.0 → 10.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +3 -3
  3. data/.github/workflows/gempush.yml +8 -6
  4. data/.gitignore +2 -3
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +14 -0
  7. data/Appraisals +5 -5
  8. data/Changelog.md +2 -40
  9. data/Gemfile +1 -0
  10. data/Gemfile.rails6.1 +11 -0
  11. data/README.md +5 -7
  12. data/data_migrate.gemspec +2 -2
  13. data/gemfiles/{rails_7.1.gemfile → rails_6.0.gemfile} +2 -1
  14. data/gemfiles/rails_6.1.gemfile +1 -0
  15. data/gemfiles/rails_7.0.gemfile +2 -1
  16. data/lib/data_migrate/data_migrator.rb +23 -15
  17. data/lib/data_migrate/data_schema.rb +2 -2
  18. data/lib/data_migrate/data_schema_migration.rb +7 -24
  19. data/lib/data_migrate/database_tasks.rb +48 -126
  20. data/lib/data_migrate/legacy_migrator.rb +22 -0
  21. data/lib/data_migrate/migration_context.rb +8 -11
  22. data/lib/data_migrate/schema_dumper.rb +1 -1
  23. data/lib/data_migrate/schema_migration.rb +4 -5
  24. data/lib/data_migrate/status_service.rb +4 -4
  25. data/lib/data_migrate/tasks/data_migrate_tasks.rb +15 -14
  26. data/lib/data_migrate/version.rb +1 -1
  27. data/lib/data_migrate.rb +1 -2
  28. data/spec/data_migrate/data_migrator_spec.rb +14 -17
  29. data/spec/data_migrate/data_schema_migration_spec.rb +8 -25
  30. data/spec/data_migrate/data_spec.rb +1 -1
  31. data/spec/data_migrate/database_tasks_spec.rb +19 -34
  32. data/spec/data_migrate/legacy_migrator_spec.rb +38 -0
  33. data/spec/data_migrate/migration_context_spec.rb +8 -15
  34. data/spec/data_migrate/schema_dumper_spec.rb +3 -6
  35. data/spec/data_migrate/schema_migration_spec.rb +6 -13
  36. data/spec/data_migrate/status_service_spec.rb +4 -7
  37. data/spec/data_migrate/tasks/data_migrate_tasks_spec.rb +14 -13
  38. data/spec/db/data/20091231235959_some_name.rb +1 -1
  39. data/spec/db/data/20171231235959_super_update.rb +1 -1
  40. data/spec/db/migrate/20131111111111_late_migration.rb +1 -1
  41. data/spec/db/migrate/20202020202011_db_migration.rb +1 -1
  42. data/tasks/databases.rake +77 -39
  43. metadata +19 -21
  44. data/Gemfile.lock +0 -184
  45. data/gemfiles/rails_6.1.gemfile.lock +0 -229
  46. data/gemfiles/rails_7.0.gemfile.lock +0 -230
  47. data/gemfiles/rails_7.1.gemfile.lock +0 -263
  48. data/lib/data_migrate/database_configurations_wrapper.rb +0 -11
  49. data/lib/data_migrate/rails_helper.rb +0 -79
  50. data/lib/data_migrate/test.rb +0 -14
@@ -1,11 +0,0 @@
1
- module DataMigrate
2
- # This wrapper is used to differentiate between
3
- # a data and schema db config when running migrations
4
- class DatabaseConfigurationWrapper
5
- attr_reader :db_config
6
-
7
- def initialize(db_config)
8
- @db_config = db_config
9
- end
10
- end
11
- end
@@ -1,79 +0,0 @@
1
- module DataMigrate
2
- class RailsHelper
3
- class << self
4
- def rails_version_equal_to_or_higher_than_7_1
5
- return @equal_to_or_higher_than_7_1 if defined?(@equal_to_or_higher_than_7_1)
6
-
7
- @equal_to_or_higher_than_7_1 = Gem::Dependency.new("railties", ">= 7.1.0.alpha").match?("railties", Gem.loaded_specs["railties"].version, true)
8
- end
9
-
10
- def rails_version_equal_to_or_higher_than_7_0
11
- return @rails_version_equal_to_or_higher_than_7_0 if defined?(@rails_version_equal_to_or_higher_than_7_0)
12
-
13
- @rails_version_equal_to_or_higher_than_7_0 = Gem::Dependency.new("railties", ">= 7.0").match?("railties", Gem.loaded_specs["railties"].version, true)
14
- end
15
-
16
- def internal_metadata
17
- if rails_version_equal_to_or_higher_than_7_1
18
- ActiveRecord::Base.connection.internal_metadata
19
- else
20
- ActiveRecord::InternalMetadata
21
- end
22
- end
23
-
24
- def schema_migration
25
- if rails_version_equal_to_or_higher_than_7_1
26
- ActiveRecord::Base.connection.schema_migration
27
- else
28
- ActiveRecord::SchemaMigration
29
- end
30
- end
31
-
32
- def schema_migration_versions
33
- if rails_version_equal_to_or_higher_than_7_1
34
- schema_migration.versions
35
- else
36
- schema_migration.all.pluck(:version)
37
- end
38
- end
39
-
40
- def schema_create_version(version)
41
- if rails_version_equal_to_or_higher_than_7_1
42
- schema_migration.create_version(version)
43
- else
44
- schema_migration.create(version: version)
45
- end
46
- end
47
-
48
- def data_schema_delete_version(version)
49
- if rails_version_equal_to_or_higher_than_7_1
50
- data_schema_migration.delete_version(version)
51
- else
52
- data_schema_migration.where(version: version.to_s).delete_all
53
- end
54
- end
55
-
56
- def data_schema_migration
57
- if rails_version_equal_to_or_higher_than_7_1
58
- DataMigrate::DataSchemaMigration.new(ActiveRecord::Tasks::DatabaseTasks.migration_connection)
59
- else
60
- DataMigrate::DataSchemaMigration
61
- end
62
- end
63
-
64
- def data_migrator(
65
- direction,
66
- migrations,
67
- schema_migration = DataMigrate::RailsHelper.schema_migration,
68
- internal_metadata = DataMigrate::RailsHelper.internal_metadata,
69
- target_version = nil
70
- )
71
- if rails_version_equal_to_or_higher_than_7_1
72
- DataMigrate::DataMigrator.new(direction, migrations, schema_migration, internal_metadata, target_version)
73
- else
74
- DataMigrate::DataMigrator.new(direction, migrations, schema_migration, target_version)
75
- end
76
- end
77
- end
78
- end
79
- end
@@ -1,14 +0,0 @@
1
- module Base
2
- extend self
3
-
4
- def foo
5
- puts "Base#foo called"
6
- end
7
- end
8
-
9
- module Child
10
- extend Base
11
- extend self
12
-
13
- puts "foo: #{respond_to?(:foo)}"
14
- end