data_migrate 10.0.0.rc1 → 10.0.3.rc

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
2
  SHA256:
3
- metadata.gz: d212f0e6fa0c9b767cbdf17854c7c52d640a9c8611d0b10ed6c0460de68985cd
4
- data.tar.gz: ac338ef447f1942d64eb5cf6c0fe520f71089968c04fb03fb829a1318534b4eb
3
+ metadata.gz: 2bb05d428228b17b10beb94404770d5290cbb9727b7185356f3833dc440a40e6
4
+ data.tar.gz: e1a996f14dce42f3743db8bc74a128893b97a41cc97c63db1202db1733b1349e
5
5
  SHA512:
6
- metadata.gz: 01ae940433e4cd51a2f421297fb3ffb72372503971ee906164129c035c89aedb6c18d5003cd083930c24245f16728c38c93aed94fb8d9b2f7d0288895362a3d4
7
- data.tar.gz: 9d94ff40ed274256247960c0dd1325645b638ac2198d29b3bce2c3c11f842b4b0a2b381bd73fcb17af308ab366cdca16c7f99c9e2fa778da7ab6103352e50ba1
6
+ metadata.gz: 005deffc4ecd6a9f02ca76c84f2fbd8ad70f4e294e6d4259d92f2e2ce1f54f1a5032767ec2a0759af762571ff99fe1f7e290d9d3ec414ba69ebc2b7b673a2c65
7
+ data.tar.gz: a4db456966db55f1b3428a239a76dd00ba352417a796957474b20cd163918fe48f79096cad7d513d9d1bd180465bbde2969c39a182c38c08afde64705d23880d
data/.gitignore CHANGED
@@ -7,5 +7,7 @@ spec/db/other_test.db
7
7
  spec/db/data_schema.rb
8
8
  .vscode/
9
9
  .DS_Store
10
+ .ruby-gemset
11
+ .ruby-version
10
12
  .idea/
11
- vendor/
13
+ vendor/
data/Changelog.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 10.0.3.rc
4
+
5
+ - Remove all travis references [leoarnold](https//:github.com/leoarnold)
6
+ - Changing to rc because of ongoing discussion how to properly handle multiple database environments
7
+
8
+ ## 10.0.2
9
+
10
+ Change "rails" dependencies to "railties"
11
+
12
+ ## 10.0.1
13
+
14
+ - Bug fix for Rails 6 config [chaunce](https//:github.com/chaunce)
15
+ - Railties bug fix by [opti](https://github.com/opti)
16
+
17
+ ## 10.0.0
18
+
19
+ Releasing 10.0.0
20
+
21
+ !!! Breaking changes !!!
22
+
23
+ - This version introduces a breaking change which may lead to undesired
24
+ behavior in multi-database environments. See https://github.com/ilyakatz/data-migrate/issues/181
25
+
3
26
  ## 10.0.0.rc1
4
27
 
5
28
  - Changes by [chaunce](https//:github.com/chaunce)
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  - [![Version](http://img.shields.io/gem/v/data_migrate.svg?style=flat-square)](https://rubygems.org/gems/data_migrate)
4
4
  - [![License](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](http://opensource.org/licenses/MIT)
5
- - [![Travis](https://img.shields.io/travis/ilyakatz/data-migrate.svg)](https://travis-ci.org/ilyakatz/data-migrate)
5
+ - ![.github/workflows/build.yml](https://github.com/ilyakatz/data-migrate/actions/workflows/.github/workflows/build.yml/badge.svg)
6
6
  - [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
7
7
 
8
8
  Run data migrations alongside schema migrations.
@@ -12,7 +12,7 @@ migrations, except they should be reserved for data migrations. For
12
12
  instance, if you realize you need to titleize all your titles, this
13
13
  is the place to do it.
14
14
 
15
- ![Travis](./screenshot.png)
15
+ ![directory tree example](./screenshot.png)
16
16
 
17
17
  ## Why should I use this?
18
18
 
@@ -92,11 +92,13 @@ You can generate a data migration as you would a schema migration:
92
92
  rake db:version:with_data # Retrieves the current schema version numbers for data and schema migrations
93
93
 
94
94
 
95
- Tasks work as they would with the 'vanilla' db version. The 'with_data' addition to the 'db' tasks will run the task in the context of both the data and schema migrations. That is, rake db:rollback:with_data will check to see if it was a schema or data migration invoked last, and do that. Tasks invoked in that space also have an additional line of output, indicating if the action is performed on data or schema.
95
+ Tasks work as they would with the 'vanilla' db version. The 'with_data' addition to the 'db' tasks will run the task in the context of both the data and schema migrations. That is, rake db:rollback:with_data will check to see if it was a schema or data migration invoked last, and do that. Tasks invoked in that space also have an additional line of output, indicating if the action is performed on data or schema.
96
96
 
97
97
  With 'up' and 'down', you can specify the option 'BOTH', which defaults to false. Using true, will migrate both the data and schema (in the desired direction) if they both match the version provided. Again, going up, schema is given precedence. Down its data.
98
98
 
99
- `rake db:migrate:status:with_data` provides and additional column to indicate which type of migration.
99
+ When using `rake db:migrate:with_data` migrations will be run in ascending order by their version. For example, if you have a data migration with version 20230410000000 and a schema migration with version 20230415000000, expect the data migration to run first.
100
+
101
+ `rake db:migrate:status:with_data` provides an additional column to indicate which type of migration.
100
102
 
101
103
  ### Configuration
102
104
 
@@ -24,9 +24,9 @@ module DataMigrate
24
24
 
25
25
  def self.migrations_paths
26
26
  spec_name = DataMigrate.config.spec_name
27
- if spec_name && Gem::Dependency.new("rails", "~> 7.0").match?("rails", Gem.loaded_specs["rails"].version)
27
+ if spec_name && Gem::Dependency.new("railties", "~> 7.0").match?("railties", Gem.loaded_specs["railties"].version)
28
28
  ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: spec_name).migrations_paths
29
- elsif spec_name && Gem::Dependency.new("rails", "~> 6.0").match?("rails", Gem.loaded_specs["rails"].version)
29
+ elsif spec_name && Gem::Dependency.new("railties", "~> 6.0").match?("railties", Gem.loaded_specs["railties"].version)
30
30
  ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, spec_name: spec_name).migrations_paths
31
31
  else
32
32
  Rails.application.config.paths["db/migrate"].to_a
@@ -44,9 +44,9 @@ module DataMigrate
44
44
  end
45
45
 
46
46
  def database_name
47
- if Gem::Dependency.new("rails", "~> 7.0").match?("rails", Gem.loaded_specs["rails"].version)
47
+ if Gem::Dependency.new("railties", "~> 7.0").match?("railties", Gem.loaded_specs["railties"].version)
48
48
  ActiveRecord::Base.connection_db_config.configuration_hash[:database]
49
- elsif Gem::Dependency.new("rails", "~> 6.0").match?("rails", Gem.loaded_specs["rails"].version)
49
+ elsif Gem::Dependency.new("railties", "~> 6.0").match?("railties", Gem.loaded_specs["railties"].version)
50
50
  ActiveRecord::Base.connection_config[:database]
51
51
  end
52
52
  end
@@ -95,9 +95,9 @@ module DataMigrate
95
95
  private
96
96
 
97
97
  def spec_name(db_config)
98
- if Gem::Dependency.new("rails", "~> 7.0").match?("rails", Gem.loaded_specs["rails"].version)
98
+ if Gem::Dependency.new("railties", "~> 7.0").match?("railties", Gem.loaded_specs["railties"].version)
99
99
  db_config.name
100
- elsif Gem::Dependency.new("rails", "~> 6.0").match?("rails", Gem.loaded_specs["rails"].version)
100
+ elsif Gem::Dependency.new("railties", "~> 6.0").match?("railties", Gem.loaded_specs["railties"].version)
101
101
  db_config.spec_name
102
102
  end
103
103
  end
@@ -1,3 +1,3 @@
1
1
  module DataMigrate
2
- VERSION = "10.0.0.rc1".freeze
2
+ VERSION = "10.0.3.rc".freeze
3
3
  end
@@ -28,7 +28,7 @@ describe DataMigrate::DatabaseTasks do
28
28
  data_migrations_path
29
29
  }
30
30
  ActiveRecord::Base.establish_connection(db_config)
31
- if Gem::Dependency.new("rails", ">= 6.1").match?("rails", Gem.loaded_specs["rails"].version)
31
+ if Gem::Dependency.new("railties", ">= 6.1").match?("railties", Gem.loaded_specs["railties"].version)
32
32
  hash_config = ActiveRecord::DatabaseConfigurations::HashConfig.new('test', 'test', db_config)
33
33
  config_obj = ActiveRecord::DatabaseConfigurations.new([hash_config])
34
34
  allow(ActiveRecord::Base).to receive(:configurations).and_return(config_obj)
@@ -61,9 +61,9 @@ describe DataMigrate::SchemaMigration do
61
61
  let(:paths) { ['spec/db/migrate', 'spec/db/migrate/other'] }
62
62
  let(:specification_name) { "primary" }
63
63
  let(:config_options) do
64
- if Gem::Dependency.new("rails", "~> 6.0").match?("rails", Gem.loaded_specs["rails"].version)
64
+ if Gem::Dependency.new("railties", "~> 6.0").match?("railties", Gem.loaded_specs["railties"].version)
65
65
  { env_name: Rails.env, spec_name: specification_name }
66
- elsif Gem::Dependency.new("rails", "~> 7.0").match?("rails", Gem.loaded_specs["rails"].version)
66
+ elsif Gem::Dependency.new("railties", "~> 7.0").match?("railties", Gem.loaded_specs["railties"].version)
67
67
  { env_name: Rails.env, name: specification_name }
68
68
  end
69
69
  end
@@ -7,7 +7,7 @@ describe DataMigrate::StatusService do
7
7
  let(:stream) { StringIO.new }
8
8
  let(:stream_data) { stream.read }
9
9
  let(:connection_db_config) do
10
- if Gem::Dependency.new("rails", ">= 6.1").match?("rails", Gem.loaded_specs["rails"].version)
10
+ if Gem::Dependency.new("railties", ">= 6.1").match?("railties", Gem.loaded_specs["railties"].version)
11
11
  ActiveRecord::Base.connection_db_config
12
12
  else
13
13
  ActiveRecord::Base.configurations.configs_for.first
@@ -4,7 +4,7 @@ require "spec_helper"
4
4
 
5
5
  describe DataMigrate::Tasks::DataMigrateTasks do
6
6
  let(:connection_db_config) do
7
- if Gem::Dependency.new("rails", ">= 6.1").match?("rails", Gem.loaded_specs["rails"].version)
7
+ if Gem::Dependency.new("railties", ">= 6.1").match?("railties", Gem.loaded_specs["railties"].version)
8
8
  ActiveRecord::Base.connection_db_config
9
9
  else
10
10
  ActiveRecord::Base.configurations.configs_for.first
data/tasks/databases.rake CHANGED
@@ -6,7 +6,12 @@ namespace :db do
6
6
  namespace :migrate do
7
7
  desc "Migrate the database data and schema (options: VERSION=x, VERBOSE=false)."
8
8
  task :with_data => :environment do
9
- original_db_config = ActiveRecord::Base.connection_db_config
9
+ original_db_config = if Gem::Dependency.new("railties", "~> 7.0").match?("railties", Gem.loaded_specs["railties"].version)
10
+ ActiveRecord::Base.connection_db_config
11
+ elsif Gem::Dependency.new("railties", "~> 6.0").match?("railties", Gem.loaded_specs["railties"].version)
12
+ ActiveRecord::Base.connection_config
13
+ end
14
+
10
15
  ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config|
11
16
  ActiveRecord::Base.establish_connection(db_config)
12
17
  DataMigrate::DataMigrator.assure_data_schema_table
@@ -204,7 +209,12 @@ end
204
209
  namespace :data do
205
210
  desc 'Migrate data migrations (options: VERSION=x, VERBOSE=false)'
206
211
  task :migrate => :environment do
207
- original_db_config = ActiveRecord::Base.connection_db_config
212
+ original_db_config = if Gem::Dependency.new("railties", "~> 7.0").match?("railties", Gem.loaded_specs["railties"].version)
213
+ ActiveRecord::Base.connection_db_config
214
+ elsif Gem::Dependency.new("railties", "~> 6.0").match?("railties", Gem.loaded_specs["railties"].version)
215
+ ActiveRecord::Base.connection_config
216
+ end
217
+
208
218
  ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config|
209
219
  ActiveRecord::Base.establish_connection(db_config)
210
220
  DataMigrate::Tasks::DataMigrateTasks.migrate
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: 10.0.0.rc1
4
+ version: 10.0.3.rc
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: 2023-04-23 00:00:00.000000000 Z
13
+ date: 2023-06-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord
@@ -198,8 +198,6 @@ files:
198
198
  - ".rspec"
199
199
  - ".rubocop.yml"
200
200
  - ".ruby-style.yml"
201
- - ".ruby-version"
202
- - ".travis.yml"
203
201
  - Appraisals
204
202
  - Changelog.md
205
203
  - Gemfile
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.7.5
data/.travis.yml DELETED
@@ -1,14 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.7
4
- - 3.0
5
- - 3.2
6
- script: bundle exec rspec
7
- gemfile:
8
- - gemfiles/rails_6.0.gemfile
9
- - gemfiles/rails_6.1.gemfile
10
- - gemfiles/rails_7.0.gemfile
11
- jobs:
12
- exclude:
13
- - rvm: 3.0
14
- - rvm: 3.2