nonschema_migrations 4.0.2 → 5.0.2
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/lib/nonschema_migrations.rb +1 -0
- data/lib/nonschema_migrator.rb +21 -7
- metadata +13 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f592f0e3bfa1f1ffcfde3f2bf34f20fe893e77e8d2d21ee199b2595863fdfc8
|
4
|
+
data.tar.gz: b97a0d86518e174ab157318170250f47936b76545cd58676dc9c6840deb2afff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be79fac6bf382b969845d9a075734439c8832e5fd682877510edbb83d0a735cacc79255ee2708fe14094ce648aa295408d3724c13a3aaaf178357fa2440060ba
|
7
|
+
data.tar.gz: 41d0b47e8af6235fda57db039eaed4ec369485dbdf71d1ed09e9d6a74d82cd5d34b13fb175d54524910e61e8f5f2fd86c32827a2e59be8e54e945abfc0318058
|
data/lib/nonschema_migrations.rb
CHANGED
data/lib/nonschema_migrator.rb
CHANGED
@@ -2,17 +2,31 @@ class NonschemaMigrator < ActiveRecord::Migrator
|
|
2
2
|
# This class related to data migration.
|
3
3
|
# Used in rake tasks (rake data:[migrate|rollback|up|down])
|
4
4
|
|
5
|
+
def initialize(direction, migrations, no_op, target_version = nil)
|
6
|
+
@direction = direction
|
7
|
+
@target_version = target_version
|
8
|
+
@migrated_versions = nil
|
9
|
+
@migrations = migrations
|
10
|
+
|
11
|
+
validate(@migrations)
|
12
|
+
|
13
|
+
ActiveRecord::InternalMetadata.create_table
|
14
|
+
end
|
15
|
+
|
5
16
|
if defined?(ActiveRecord::MigrationContext)
|
6
|
-
class
|
17
|
+
class NonSchemaMigration < ActiveRecord::SchemaMigration
|
7
18
|
def self.table_name
|
8
19
|
NonschemaMigrator.schema_migrations_table_name
|
9
20
|
end
|
10
21
|
end
|
11
22
|
|
12
23
|
class MigrationContext < ActiveRecord::MigrationContext
|
13
|
-
def initialize(migrations_paths)
|
14
|
-
|
15
|
-
|
24
|
+
def initialize(migrations_paths, data_migration)
|
25
|
+
|
26
|
+
# super(migrations_paths, data_migration)
|
27
|
+
@migrations_paths = migrations_paths
|
28
|
+
|
29
|
+
@schema_migration = NonschemaMigrator::NonSchemaMigration
|
16
30
|
end
|
17
31
|
|
18
32
|
def new_migrator(*args)
|
@@ -23,7 +37,7 @@ class NonschemaMigrator < ActiveRecord::Migrator
|
|
23
37
|
|
24
38
|
# these methods are copied from ActiveRecord::Migrator
|
25
39
|
# replaced:
|
26
|
-
# 1.) ActiveRecord::
|
40
|
+
# 1.) ActiveRecord::NonSchemaMigration with @schema_migration
|
27
41
|
# 2.) ActiveRecord::Migrator.new with new_migrator
|
28
42
|
|
29
43
|
def get_all_versions
|
@@ -57,7 +71,7 @@ class NonschemaMigrator < ActiveRecord::Migrator
|
|
57
71
|
end
|
58
72
|
|
59
73
|
def move(direction, steps)
|
60
|
-
migrator = new_migrator(direction, migrations)
|
74
|
+
migrator = new_migrator(direction, migrations, schema_migration)
|
61
75
|
|
62
76
|
if current_version != 0 && !migrator.current_migration
|
63
77
|
raise UnknownMigrationVersionError.new(current_version)
|
@@ -98,7 +112,7 @@ class NonschemaMigrator < ActiveRecord::Migrator
|
|
98
112
|
|
99
113
|
class << self
|
100
114
|
def context(path)
|
101
|
-
NonschemaMigrator::MigrationContext.new(path)
|
115
|
+
NonschemaMigrator::MigrationContext.new(path, ActiveRecord::DataMigration)
|
102
116
|
end
|
103
117
|
|
104
118
|
def new_migrator(path, *args)
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nonschema_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Fleetwood-Boldt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '6.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '6.0'
|
30
|
+
- - "<"
|
25
31
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
32
|
+
version: '7'
|
27
33
|
description: Separate schema-only migrations from nonschema (data) migrations in your
|
28
34
|
Rails app
|
29
35
|
email: jason.fb@datatravels.com
|
@@ -58,8 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
64
|
- !ruby/object:Gem::Version
|
59
65
|
version: '0'
|
60
66
|
requirements: []
|
61
|
-
|
62
|
-
rubygems_version: 2.7.9
|
67
|
+
rubygems_version: 3.1.0.pre3
|
63
68
|
signing_key:
|
64
69
|
specification_version: 4
|
65
70
|
summary: Nonschema(data-only) migrations for your Rails app
|