nonschema_migrations 3.0.1 → 4.0.0

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: 63001140252d2427c6d7ca56069ddf63633941c94350f4cfd04f8b88290cc568
4
- data.tar.gz: af9cf93b6f6fac5bf7ac755935c5f6a7c6ddd531bbe4c35805d96d67b70079df
3
+ metadata.gz: 060a8252f8c50e08554a63d6dc7eda69c3787b1371378dd67ec996ccdcafb693
4
+ data.tar.gz: 3fdf7873eb61ae75a48c79129ec8529f9a278ecc351e6118343a14d0849d1ee0
5
5
  SHA512:
6
- metadata.gz: 655d20058daecd6ba7ca2feb9ab4940fef0e1d39526f4edabc97f0c534d8857ce4105fb765bf94da0136b6b4b59777dd8199075e19f6a360184a5057ec818ca2
7
- data.tar.gz: 054f4bb67a781214fe60f4df1674fc7f757d98ef8d678b9429b38856e98a98ed5684ab81cf137bb1983f1fe5f0e2dccffb8ef5fa73573531662add89fc59e87f
6
+ metadata.gz: 39109601de547582da8d0931a5a51320e807482be4b08d22bc12342c4c16804c23213bd3bef22f2b901773776519a636ae3d3776feecc3a3912fac097d1e3ed9
7
+ data.tar.gz: 245136e81e8f63a5b0f4e9e15f59b354814d0d488e7f55af7acde157e88e7d48d2bd0c7c48a2cc9271c1d9e2699b0dedf5995a1d11dc005076085184cfa0e7a8
@@ -1,4 +1,4 @@
1
- class CreateDataMigrations < ActiveRecord::Migration[5.1]
1
+ class CreateDataMigrations < ActiveRecord::Migration[5.2]
2
2
  def self.up
3
3
  create_table :data_migrations do |t|
4
4
  t.string :version
@@ -6,6 +6,6 @@ require 'generators/data_migration_generator.rb'
6
6
  require 'active_record/data_migration.rb'
7
7
  require 'nonschema_migrator.rb'
8
8
 
9
- module NonschemaMigrations
9
+ module NondestructiveMigrations
10
10
  require "nonschema_migrations/railtie.rb" if defined?(Rails)
11
11
  end
@@ -1,25 +1,25 @@
1
1
 
2
2
 
3
3
 
4
- class NonschemaMigrator < ActiveRecord::Migrator
4
+ class NondestructiveMigrator < ActiveRecord::Migrator
5
5
  # This class related to data migration.
6
6
  # Used in rake tasks (rake data:[migrate|rollback|up|down])
7
7
 
8
8
  if defined?(ActiveRecord::MigrationContext)
9
9
  class SchemaMigration < ActiveRecord::SchemaMigration
10
10
  def self.table_name
11
- NonschemaMigrator.schema_migrations_table_name
11
+ NondestructiveMigrator.schema_migrations_table_name
12
12
  end
13
13
  end
14
14
 
15
15
  class MigrationContext < ActiveRecord::MigrationContext
16
16
  def initialize(migrations_paths)
17
17
  super(migrations_paths)
18
- @schema_migration = NonschemaMigrator::SchemaMigration
18
+ @schema_migration = NondestructiveMigrator::SchemaMigration
19
19
  end
20
20
 
21
21
  def new_migrator(*args)
22
- result = NonschemaMigrator.new(*args)
22
+ result = NondestructiveMigrator.new(*args)
23
23
  result.migration_context = self
24
24
  result
25
25
  end
@@ -55,12 +55,6 @@ class NonschemaMigrator < ActiveRecord::Migrator
55
55
  (db_list + file_list).sort_by { |_, version, _| version }
56
56
  end
57
57
 
58
-
59
- def rollback(steps)
60
- move(:down, steps)
61
- end
62
-
63
-
64
58
  def move(direction, steps)
65
59
  migrator = new_migrator(direction, migrations)
66
60
 
@@ -103,7 +97,7 @@ class NonschemaMigrator < ActiveRecord::Migrator
103
97
 
104
98
  class << self
105
99
  def context(path)
106
- NonschemaMigrator::MigrationContext.new(path)
100
+ NondestructiveMigrator::MigrationContext.new(path)
107
101
  end
108
102
 
109
103
  def new_migrator(path, *args)
@@ -162,4 +156,6 @@ class NonschemaMigrator < ActiveRecord::Migrator
162
156
  end
163
157
  end
164
158
  end
165
- end
159
+ end
160
+
161
+
data/lib/tasks/data.rb CHANGED
@@ -7,13 +7,13 @@ namespace :data do
7
7
 
8
8
  desc "run data migration (#{MIGRATIONS_PATH})"
9
9
  task :migrate => :data_migration_dependencies do
10
- NonschemaMigrator.migrate(MIGRATIONS_PATH)
10
+ NondestructiveMigrator.migrate(MIGRATIONS_PATH)
11
11
  end
12
12
 
13
13
  desc "rollback data migration (#{MIGRATIONS_PATH})"
14
14
  task :rollback => :data_migration_dependencies do
15
15
  step = ENV['STEP'] ? ENV['STEP'].to_i : 1
16
- NonschemaMigrator.rollback(MIGRATIONS_PATH,step)
16
+ NondestructiveMigrator.rollback(MIGRATIONS_PATH,step)
17
17
  end
18
18
 
19
19
  namespace :migrate do
@@ -21,14 +21,14 @@ namespace :data do
21
21
  task :up => :data_migration_dependencies do
22
22
  version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
23
23
  raise "VERSION is required" unless version
24
- NonschemaMigrator.run(:up, MIGRATIONS_PATH, version)
24
+ NondestructiveMigrator.run(:up, MIGRATIONS_PATH, version)
25
25
  end
26
26
 
27
27
  desc %Q{runs the "down" for a given _data_ migration VERSION}
28
28
  task :down => :data_migration_dependencies do
29
29
  version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
30
30
  raise "VERSION is required" unless version
31
- NonschemaMigrator.run(:down, MIGRATIONS_PATH, version)
31
+ NondestructiveMigrator.run(:down, MIGRATIONS_PATH, version)
32
32
  end
33
33
  end
34
34
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nonschema_migrations
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 4.0.0
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-06-01 00:00:00.000000000 Z
11
+ date: 2019-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.1'
19
+ version: '5.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.1'
26
+ version: '5.2'
27
27
  description: Separate schema-only migrations from nonschema (data) migrations in your
28
28
  Rails app
29
29
  email: jason.fb@datatravels.com