data_migrate 11.2.0 → 11.3.0
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 +4 -4
- data/Changelog.md +5 -1
- data/README.md +10 -7
- data/lib/data_migrate/config.rb +2 -1
- data/lib/data_migrate/data_migrator.rb +0 -1
- data/lib/data_migrate/data_schema_migration.rb +2 -2
- data/lib/data_migrate/database_tasks.rb +11 -3
- data/lib/data_migrate/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20f45c0a409f5eea659d56b8118d9625e3358cdd9d199978b56359d3416abe64
|
4
|
+
data.tar.gz: f553fd264b97b71671556ece98e9c79830223e960e7f41a46e383587a7b728c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ac579c9ca5323c12e413f4c2ad228f9f36cbeb7d84624ff6fa24160f350b5e91f3ca7a8f18e469ce8e25dd4390a9d76316f40257dd9ef5bf4324c60309dd55f
|
7
|
+
data.tar.gz: f2fe12d32734ba839ce736d6634d2e794aad151b2719ff6e4a9bf1c9a05ccfdc4ab2a2de6bed8636a9423e89d6dddf62442ccf2f4c91ede15cf66736f36ff64f
|
data/Changelog.md
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
# 11.
|
3
|
+
# 11.3.0
|
4
|
+
- Make table_name configurable https://github.com/ilyakatz/data-migrate/pull/361
|
5
|
+
- Use lease_connection over deprecated connection for rails 8 https://github.com/ilyakatz/data-migrate/pull/353
|
6
|
+
- Add Ruby 3.4 to CI matrix
|
4
7
|
|
8
|
+
# 11.2.0
|
5
9
|
- Remove committed Gemfile.lock, reduce bundled file list when running `gem install` https://github.com/ilyakatz/data-migrate/pull/351
|
6
10
|
- [Bump actionpack from 7.1.3.4 to 7.1.4.1](https://github.com/ilyakatz/data-migrate/pull/348)
|
7
11
|
- [Bump rexml from 3.3.6 to 3.3.9](https://github.com/ilyakatz/data-migrate/pull/349)
|
data/README.md
CHANGED
@@ -36,7 +36,7 @@ table to track all migrations.
|
|
36
36
|
|
37
37
|
## Rails Support
|
38
38
|
|
39
|
-
Support Rails 6.1 through
|
39
|
+
Support Rails 6.1 through 8.0
|
40
40
|
|
41
41
|
For **Rails 6.0** support, please use gem version `9.1.x`:
|
42
42
|
|
@@ -115,6 +115,7 @@ You can override this setting in `config/initializers/data_migrate.rb`
|
|
115
115
|
|
116
116
|
```ruby
|
117
117
|
DataMigrate.configure do |config|
|
118
|
+
config.data_migrations_table_name = 'my_migrations_database_name'
|
118
119
|
config.data_migrations_path = 'db/awesomepath/'
|
119
120
|
config.data_template_path = Rails.root.join("lib", "awesomepath", "custom_data_migration.rb")
|
120
121
|
config.db_configuration = {
|
@@ -144,7 +145,7 @@ From now on capistrano will run `rake db:migrate:with_data` in every deploy.
|
|
144
145
|
## Rails Engines support
|
145
146
|
|
146
147
|
This gem also has a initial support for adding data migrations inside Rails engines.
|
147
|
-
Just add your engines directory pattern to data_migrations initializer, for example
|
148
|
+
Just add your engines directory pattern to data_migrations initializer, for example
|
148
149
|
in the case your engines are located in `engines` folder you can set it up like this:
|
149
150
|
|
150
151
|
```ruby
|
@@ -166,15 +167,17 @@ bundle exec appraisal rails-6.1 rspec
|
|
166
167
|
bundle exec appraisal rails-7.0 rspec
|
167
168
|
bundle exec appraisal rails-7.1 rspec
|
168
169
|
bundle exec appraisal rails-7.2 rspec
|
170
|
+
bundle exec appraisal rails-8.0 rspec
|
169
171
|
```
|
170
172
|
|
171
173
|
## Releasing new version
|
172
174
|
|
173
|
-
1.
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
175
|
+
1. Update version.rb file, run `bundle exec appraisal` to update the version in corresponding gemfile.lock
|
176
|
+
2. Create a new tag, eg `git tag 9.4.1`
|
177
|
+
3. Go to https://github.com/ilyakatz/data-migrate/tags
|
178
|
+
4. Click "Create release" under 9.4.1
|
179
|
+
5. CLick "Generate release notes"
|
180
|
+
6. Click "Publish release"
|
178
181
|
|
179
182
|
## Thanks
|
180
183
|
|
data/lib/data_migrate/config.rb
CHANGED
@@ -12,11 +12,12 @@ module DataMigrate
|
|
12
12
|
end
|
13
13
|
|
14
14
|
class Config
|
15
|
-
attr_accessor :data_migrations_path, :data_template_path, :db_configuration, :spec_name
|
15
|
+
attr_accessor :data_migrations_table_name, :data_migrations_path, :data_template_path, :db_configuration, :spec_name
|
16
16
|
|
17
17
|
DEFAULT_DATA_TEMPLATE_PATH = "data_migration.rb"
|
18
18
|
|
19
19
|
def initialize
|
20
|
+
@data_migrations_table_name = "data_migrations"
|
20
21
|
@data_migrations_path = "db/data/"
|
21
22
|
@data_template_path = DEFAULT_DATA_TEMPLATE_PATH
|
22
23
|
@db_configuration = nil
|
@@ -48,7 +48,6 @@ module DataMigrate
|
|
48
48
|
|
49
49
|
# TODO: this was added to be backward compatible, need to re-evaluate
|
50
50
|
def migrations(_migrations_paths)
|
51
|
-
#DataMigrate::MigrationContext.new(migrations_paths).migrations
|
52
51
|
DataMigrate::MigrationContext.new(_migrations_paths).migrations
|
53
52
|
end
|
54
53
|
|
@@ -4,7 +4,7 @@ module DataMigrate
|
|
4
4
|
# So we only load the appropriate methods depending on Rails version.
|
5
5
|
if DataMigrate::RailsHelper.rails_version_equal_to_or_higher_than_7_1
|
6
6
|
def table_name
|
7
|
-
ActiveRecord::Base.table_name_prefix +
|
7
|
+
ActiveRecord::Base.table_name_prefix + DataMigrate.config.data_migrations_table_name + ActiveRecord::Base.table_name_suffix
|
8
8
|
end
|
9
9
|
|
10
10
|
def primary_key
|
@@ -13,7 +13,7 @@ module DataMigrate
|
|
13
13
|
else
|
14
14
|
class << self
|
15
15
|
def table_name
|
16
|
-
ActiveRecord::Base.table_name_prefix +
|
16
|
+
ActiveRecord::Base.table_name_prefix + DataMigrate.config.data_migrations_table_name + ActiveRecord::Base.table_name_suffix
|
17
17
|
end
|
18
18
|
|
19
19
|
def primary_key
|
@@ -9,6 +9,13 @@ module DataMigrate
|
|
9
9
|
extend ActiveRecord::Tasks::DatabaseTasks
|
10
10
|
extend self
|
11
11
|
|
12
|
+
if respond_to?(:register_task)
|
13
|
+
register_task(/mysql/, "ActiveRecord::Tasks::MySQLDatabaseTasks")
|
14
|
+
register_task(/trilogy/, "ActiveRecord::Tasks::MySQLDatabaseTasks")
|
15
|
+
register_task(/postgresql/, "ActiveRecord::Tasks::PostgreSQLDatabaseTasks")
|
16
|
+
register_task(/sqlite/, "ActiveRecord::Tasks::SQLiteDatabaseTasks")
|
17
|
+
end
|
18
|
+
|
12
19
|
# These method are only introduced in Rails 7.1
|
13
20
|
unless respond_to?(:with_temporary_pool_for_each)
|
14
21
|
def with_temporary_pool_for_each(env: ActiveRecord::Tasks::DatabaseTasks.env, name: nil, &block) # :nodoc:
|
@@ -99,7 +106,7 @@ module DataMigrate
|
|
99
106
|
end
|
100
107
|
|
101
108
|
def sort_migrations(*migrations)
|
102
|
-
migrations.flatten.sort { |a, b|
|
109
|
+
migrations.flatten.sort { |a, b| sort_string(a) <=> sort_string(b) }
|
103
110
|
end
|
104
111
|
|
105
112
|
def sort_string migration
|
@@ -159,7 +166,7 @@ module DataMigrate
|
|
159
166
|
data_migrator = DataMigrate::RailsHelper.data_migrator(:up, data_migrations)
|
160
167
|
sort_migrations(
|
161
168
|
data_migrator.pending_migrations.map { |m| { version: m.version, name: m.name, kind: :data } }
|
162
|
-
|
169
|
+
)
|
163
170
|
end
|
164
171
|
|
165
172
|
def pending_schema_migrations
|
@@ -219,7 +226,8 @@ module DataMigrate
|
|
219
226
|
next unless primary?(db_config)
|
220
227
|
|
221
228
|
with_temporary_pool(db_config) do |pool|
|
222
|
-
|
229
|
+
connection = pool.respond_to?(:lease_connection) ? pool.lease_connection : pool.connection
|
230
|
+
unless database_exists?(connection)
|
223
231
|
create(db_config)
|
224
232
|
if File.exist?(schema_dump_path(db_config))
|
225
233
|
load_schema(db_config, schema_format, nil)
|
data/lib/data_migrate/version.rb
CHANGED
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_migrate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.
|
4
|
+
version: 11.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew J Vargo
|
8
8
|
- Ilya Katz
|
9
9
|
- Deborah Enomah
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2025-03-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -218,7 +218,7 @@ homepage: https://github.com/ilyakatz/data-migrate
|
|
218
218
|
licenses:
|
219
219
|
- MIT
|
220
220
|
metadata: {}
|
221
|
-
post_install_message:
|
221
|
+
post_install_message:
|
222
222
|
rdoc_options: []
|
223
223
|
require_paths:
|
224
224
|
- lib
|
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
234
|
version: '0'
|
235
235
|
requirements: []
|
236
236
|
rubygems_version: 3.4.19
|
237
|
-
signing_key:
|
237
|
+
signing_key:
|
238
238
|
specification_version: 4
|
239
239
|
summary: Rake tasks to migrate data alongside schema changes.
|
240
240
|
test_files: []
|