nonschema_migrations 4.0.2 → 5.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nonschema_migrations.rb +0 -1
- data/lib/nonschema_migrator.rb +21 -7
- metadata +28 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a4d839b2348d7017c3cfcf92280fd2f8149d1d8b7f162c6aa9fce8fe8a1b63e
|
4
|
+
data.tar.gz: a9eeef10687326e01521d4434dba004596cd79643e9945d07d1efb140c26382c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 184b341e53c1a5add682b390a52371d6aec3e1ded8558d23b7555985a4cb97bc282a47467e2169cb62ea1612870ecfa3798a7d17157cacd2d7675a4e63566f5c
|
7
|
+
data.tar.gz: 986307b208729c1f154ff95592b1678c6d8ecdd041bd691921ee8630e6c6bd9c5fbdbd54c0777ec771564491549cca1ebbeed43657872150dfff32014b09de54
|
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,32 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nonschema_migrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Fleetwood-Boldt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-14 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
|
-
email:
|
35
|
+
email: code@jasonfb.net
|
30
36
|
executables: []
|
31
37
|
extensions: []
|
32
38
|
extra_rdoc_files: []
|
@@ -39,11 +45,20 @@ files:
|
|
39
45
|
- lib/nonschema_migrations/railtie.rb
|
40
46
|
- lib/nonschema_migrator.rb
|
41
47
|
- lib/tasks/data.rb
|
42
|
-
homepage: https://
|
48
|
+
homepage: https://jasonfleetwoodboldt.com/my-open-source-projects/nonschema
|
43
49
|
licenses:
|
44
50
|
- MIT
|
45
|
-
metadata:
|
46
|
-
|
51
|
+
metadata:
|
52
|
+
source_code_uri: https://github.com/jasonfb/nonschema_migrations
|
53
|
+
documentation_uri: https://jasonfleetwoodboldt.com/my-open-source-projects/nonschema-migrations/
|
54
|
+
homepage_uri: https://jasonfleetwoodboldt.com/my-open-source-projects/nonschema-migrations/
|
55
|
+
post_install_message: |
|
56
|
+
---------------------------------------------
|
57
|
+
Welcome to Nonschema Migrations
|
58
|
+
to set up, please run
|
59
|
+
|
60
|
+
rails generate data_migrations:install
|
61
|
+
---------------------------------------------
|
47
62
|
rdoc_options: []
|
48
63
|
require_paths:
|
49
64
|
- lib
|
@@ -58,9 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
73
|
- !ruby/object:Gem::Version
|
59
74
|
version: '0'
|
60
75
|
requirements: []
|
61
|
-
|
62
|
-
|
63
|
-
signing_key:
|
76
|
+
rubygems_version: 3.1.4
|
77
|
+
signing_key:
|
64
78
|
specification_version: 4
|
65
79
|
summary: Nonschema(data-only) migrations for your Rails app
|
66
80
|
test_files: []
|