data_migrate 6.0.1.beta → 6.0.3.beta

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
  SHA256:
3
- metadata.gz: 82df1d98f4ca46a882e5008667428c15a91fdfb41601df6d1241b9e87cb4e35f
4
- data.tar.gz: 81b2c71177397ad31851e998235d2c116ebca7c94c04abdcb3dc6257cfa4ff54
3
+ metadata.gz: 62ee3cf7421520ff906f2eb711b4af8986e60177d6fb4ec4ea44606b5756ed86
4
+ data.tar.gz: 8ff0412f9c8d48328289f3a8dcd187ec3a254a7cf59ce598d641e5c880e2d8f4
5
5
  SHA512:
6
- metadata.gz: 64257b2ed0d1a71caad5b3ef113a1c578e09cbff58e98f304dc6abc1919ae279da186103cb1af9b4d873163365cec76d62d6ba311861a3a7cccb860fc171a707
7
- data.tar.gz: 0df8009342ec00db007e572377103057280e70f49076050fb840fcf70aef1fedea5a5e8020bb0000f5eb1de978beb919e536c027609b62a505470f90c15af7c2
6
+ metadata.gz: 69c7de84ed210feedd61f220fa97538356c500408f4280f97405d4a1a24438f3f6dc4947cc8d4da8827d1427a97f7cc55602ad0069d0412abc1e7ffa88561ae6
7
+ data.tar.gz: b6c02d4128e90f1a958c35c6a50e30a504f361c91ff0fa3caca28d29f961e5f2b87af46705b4f80ab3e9ac9fe1a66247eb71335de26e462b759f4a7a76d57960
@@ -1,6 +1,11 @@
1
1
  # Changelog
2
2
 
3
- ## 6.0.1
3
+ ## 6.0.3.beta
4
+
5
+ Compatiblity with Rails 6 RC2 [y-yagi](https://github.com/y-yagi)
6
+
7
+ ## 6.0.1.beta
8
+
4
9
  Fix migrations being generated in wrong folder
5
10
 
6
11
  ## 6.0.0
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "http://rubygems.org"
4
4
 
5
- gem "rails", "~> 6.0.0.beta3"
5
+ gem "rails", "~> 6.0.0.rc2"
6
6
  gem "sqlite3", "~> 1.4"
7
7
 
8
8
  gemspec path: "../"
@@ -14,7 +14,7 @@ require File.join(File.dirname(__FILE__), "data_migrate", "database_tasks")
14
14
  require File.join(File.dirname(__FILE__), "data_migrate", "schema_dumper")
15
15
  if Rails::VERSION::MAJOR == 6
16
16
  require File.join(File.dirname(__FILE__), "data_migrate", "status_service_five")
17
- require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration_five")
17
+ require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration_six")
18
18
  elsif Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR == 2
19
19
  require File.join(File.dirname(__FILE__), "data_migrate", "status_service_five")
20
20
  require File.join(File.dirname(__FILE__), "data_migrate", "schema_migration_five")
@@ -0,0 +1,31 @@
1
+ module DataMigrate
2
+ # Helper class to getting access to db schema
3
+ # to allow data/schema combiation tasks
4
+ class SchemaMigration
5
+ def self.pending_schema_migrations
6
+ all_migrations = DataMigrate::MigrationContext.new(migrations_paths).migrations
7
+ sort_migrations(
8
+ ActiveRecord::Migrator.new(:up, all_migrations, ActiveRecord::Base.connection.schema_migration).
9
+ pending_migrations.
10
+ map {|m| { version: m.version, kind: :schema }}
11
+ )
12
+ end
13
+
14
+ def self.run(direction, migration_paths, version)
15
+ ActiveRecord::MigrationContext.new(migration_paths, ActiveRecord::Base.connection.schema_migration).run(direction, version)
16
+ end
17
+
18
+ def self.sort_migrations(set1, set2 = nil)
19
+ migrations = set1 + (set2 || [])
20
+ migrations.sort {|a, b| sort_string(a) <=> sort_string(b)}
21
+ end
22
+
23
+ def self.migrations_paths
24
+ Rails.application.config.paths["db/migrate"].to_a
25
+ end
26
+
27
+ def self.sort_string(migration)
28
+ "#{migration[:version]}_#{migration[:kind] == :data ? 1 : 0}"
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module DataMigrate
2
- VERSION = "6.0.1.beta".freeze
2
+ VERSION = "6.0.3.beta".freeze
3
3
  end
@@ -10,7 +10,7 @@ describe DataMigrate::DataMigrator do
10
10
  }
11
11
  let(:schema_context) {
12
12
  if (Rails::VERSION::MAJOR == 6)
13
- ActiveRecord::MigrationContext.new("spec/db/migrate/6.0")
13
+ ActiveRecord::MigrationContext.new("spec/db/migrate/6.0", ActiveRecord::Base.connection.schema_migration)
14
14
  else
15
15
  ActiveRecord::MigrationContext.new("spec/db/migrate/5.2")
16
16
  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: 6.0.1.beta
4
+ version: 6.0.3.beta
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: 2019-05-05 00:00:00.000000000 Z
13
+ date: 2019-08-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -217,6 +217,7 @@ files:
217
217
  - lib/data_migrate/schema_dumper.rb
218
218
  - lib/data_migrate/schema_migration.rb
219
219
  - lib/data_migrate/schema_migration_five.rb
220
+ - lib/data_migrate/schema_migration_six.rb
220
221
  - lib/data_migrate/status_service.rb
221
222
  - lib/data_migrate/status_service_five.rb
222
223
  - lib/data_migrate/tasks/data_migrate_tasks.rb
@@ -285,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
286
  - !ruby/object:Gem::Version
286
287
  version: 1.3.1
287
288
  requirements: []
288
- rubygems_version: 3.0.3
289
+ rubygems_version: 3.0.1
289
290
  signing_key:
290
291
  specification_version: 4
291
292
  summary: Rake tasks to migrate data alongside schema changes.