data_migrate 8.0.0 → 8.2.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 +13 -0
- data/README.md +21 -14
- data/lib/data_migrate/data_schema_migration.rb +7 -8
- data/lib/data_migrate/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba5ee2c5d78ddb60b5b23067b5103c4f1dba6d1249984dfe2489382cc9bc9f1a
|
4
|
+
data.tar.gz: d6ed21a477ffe26c2705f9582a4f370e1a20807297200ba62988ada34c0f42fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d31827b46b9def6d3be01606f027e040cc340e3c4aebea687980f2eefa4ca86acd92f9fb495c6b25578c69f8cfba78aa8ac6863b276945450e43323ff2458fec
|
7
|
+
data.tar.gz: eec842d6f96134abea3945d27e4d366f8f093ac0cfe14ff7f4931b61c2a872cd21fe4c19e7ccec54dedba470b224bf0b9b199f3c4941cad0d2b896de5211b8ac
|
data/Changelog.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 8.2.0
|
4
|
+
|
5
|
+
Delegate to anonymous subclass of AR::SchemaMigration [foxondo](https://github.com/foxondo)
|
6
|
+
|
7
|
+
## 8.1.1
|
8
|
+
|
9
|
+
Revert 8.1.0 changes
|
10
|
+
|
11
|
+
## 8.1.0
|
12
|
+
|
13
|
+
Avoid globally accessible functions for all rake tasks [berniechiu](https://github.com/berniechiu)
|
14
|
+
fixed `db:migrate:with_data` to compare data schema versions correctly [cadactive](https://github.com/cadactive)
|
15
|
+
|
3
16
|
## 8.0.0.rc2
|
4
17
|
|
5
18
|
Bug fixes [gdott9](https://github.com/gdott9)
|
data/README.md
CHANGED
@@ -38,20 +38,6 @@ table to track all migrations.
|
|
38
38
|
|
39
39
|
Support Rails 5.2 through 7.0
|
40
40
|
|
41
|
-
### Important notes for older versions
|
42
|
-
|
43
|
-
#### v2
|
44
|
-
|
45
|
-
If you upgraded to Rails 4 while using `data_migrate` prior to version 2,
|
46
|
-
the gem wrote data migration versions into
|
47
|
-
`schema_migrations` table. After the fix, it was corrected to write into
|
48
|
-
`data_migrations`.
|
49
|
-
|
50
|
-
If you need to use these old migrations, add the following configuration
|
51
|
-
|
52
|
-
It is recommended to move all legacy migrations from `schema_migrations` table into `data_migrations` table
|
53
|
-
|
54
|
-
This may cause some unintended consequences. See [#22](https://github.com/ilyakatz/data-migrate/issues/22)
|
55
41
|
|
56
42
|
#### v1
|
57
43
|
|
@@ -146,6 +132,27 @@ require 'capistrano/data_migrate'
|
|
146
132
|
|
147
133
|
From now on capistrano will run `rake db:migrate:with_data` in every deploy.
|
148
134
|
|
135
|
+
## Rails Engines support
|
136
|
+
|
137
|
+
This gem also has a initial support for adding data migrations inside Rails engines.
|
138
|
+
Inside the Engine's class initializer (the one that inherits from `Rails::Engine`, usually inside `engines/ENGINE_NAME/lib/engine.rb`) you need to add something like this:
|
139
|
+
|
140
|
+
|
141
|
+
```ruby
|
142
|
+
module EngineName
|
143
|
+
class Engine < ::Rails::Engine
|
144
|
+
initializer :engine_name do |app|
|
145
|
+
::DataMigrate.configure do |data_migrate|
|
146
|
+
default_path = ::DataMigrate::Config.new.data_migrations_path
|
147
|
+
data_migrate.data_migrations_path = [default_path, root.join('db', 'data')]
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
```
|
153
|
+
|
154
|
+
Then, in the Engine's `db/data` folder, you can add data migrations and run them as usual.
|
155
|
+
|
149
156
|
### Contributing
|
150
157
|
|
151
158
|
## Testing
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module DataMigrate
|
2
|
-
class DataSchemaMigration
|
3
|
-
|
2
|
+
class DataSchemaMigration
|
4
3
|
class << self
|
5
|
-
|
6
|
-
ActiveRecord::Base.table_name_prefix + 'data_migrations' + ActiveRecord::Base.table_name_suffix
|
7
|
-
end
|
4
|
+
delegate :table_name, :primary_key, :create_table, :normalized_versions, :create, :create!, :table_exists?, :where, to: :instance
|
8
5
|
|
9
|
-
def
|
10
|
-
|
6
|
+
def instance
|
7
|
+
@instance ||= Class.new(::ActiveRecord::SchemaMigration) do
|
8
|
+
define_singleton_method(:table_name) { ActiveRecord::Base.table_name_prefix + 'data_migrations' + ActiveRecord::Base.table_name_suffix }
|
9
|
+
define_singleton_method(:primary_key) { "version" }
|
10
|
+
end
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
15
|
-
|
data/lib/data_migrate/version.rb
CHANGED
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: 8.
|
4
|
+
version: 8.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: 2022-
|
13
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
@@ -291,7 +291,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
291
|
- !ruby/object:Gem::Version
|
292
292
|
version: '0'
|
293
293
|
requirements: []
|
294
|
-
rubygems_version: 3.
|
294
|
+
rubygems_version: 3.3.7
|
295
295
|
signing_key:
|
296
296
|
specification_version: 4
|
297
297
|
summary: Rake tasks to migrate data alongside schema changes.
|