seed_migrator 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/seed_migrator/create/create_generator.rb +4 -3
- data/lib/generators/seed_migrator/create/templates/data_update.rb +2 -2
- data/lib/generators/seed_migrator/create/templates/data_update_migration.rb +2 -2
- data/lib/generators/seed_migrator/install/templates/data_update_module.rb +1 -1
- metadata +22 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e413f192d1217e9beb4421d31e29611ee60baacdfed3b9b69b953d882981c59
|
4
|
+
data.tar.gz: a98a29afac4ba9428c065d961bb5948ea4b29612b6993d21e616b420f9873e0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63dcdfde64cf2537d1479c4fa8f1276010211bbac6a1341442120713f3f0d3334aa76332a88bc4d228b852bd3e3f8630b17ffa1c19300149d843260188f4d4a8
|
7
|
+
data.tar.gz: f5a8003b94a986529dec0a0e8de76e8e15e3e26a313d6ac9dc7b165fe832c8114da4e66791901f247ec5bc0a135fe18d7a473f9a9c28a460d7e509de2ceca10f
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "rails/generators/active_record"
|
2
|
+
require "generators/seed_migrator/helper"
|
3
3
|
|
4
4
|
# Generator to create a data update + associated migration
|
5
5
|
class SeedMigrator::CreateGenerator < Rails::Generators::NamedBase
|
6
6
|
include Generators::SeedMigrator::Helper
|
7
7
|
include Rails::Generators::Migration
|
8
8
|
|
9
|
-
source_root File.expand_path(
|
9
|
+
source_root File.expand_path("../templates", __FILE__)
|
10
10
|
|
11
11
|
# Creates the data update file and the migration file.
|
12
12
|
def create_helper_file
|
@@ -14,6 +14,7 @@ class SeedMigrator::CreateGenerator < Rails::Generators::NamedBase
|
|
14
14
|
migration_template "data_update_migration.rb", "db/migrate/#{file_name}.rb"
|
15
15
|
end
|
16
16
|
|
17
|
+
# The next available migration number for the given directory name.
|
17
18
|
def self.next_migration_number dirname
|
18
19
|
ActiveRecord::Generators::Base.next_migration_number dirname
|
19
20
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
class <%= data_update_class_name %> < SeedMigrator::Updater
|
2
2
|
def perform_update
|
3
|
-
# <%= class_name %>.create :type_code =>
|
3
|
+
# <%= class_name %>.create :type_code => "very_shiny"
|
4
4
|
end
|
5
5
|
|
6
6
|
# Overridden in case we need to roll back this migration.
|
7
7
|
def undo_update
|
8
|
-
# <%= class_name %>.where(:type_code =>
|
8
|
+
# <%= class_name %>.where(:type_code => "very_shiny").first.delete
|
9
9
|
end
|
10
10
|
end
|
@@ -2,10 +2,10 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|
2
2
|
include <%= application_class_name %>DataUpdate
|
3
3
|
|
4
4
|
def up
|
5
|
-
apply_update
|
5
|
+
apply_update "<%= data_update_file_name %>"
|
6
6
|
end
|
7
7
|
|
8
8
|
def down
|
9
|
-
revert_update
|
9
|
+
revert_update "<%= data_update_file_name %>"
|
10
10
|
end
|
11
11
|
end
|
@@ -4,7 +4,7 @@ module <%= application_class_name %>DataUpdate
|
|
4
4
|
|
5
5
|
# Returns the path where data updates are
|
6
6
|
def root_updates_path
|
7
|
-
<%= full_application_class_name %>.root.join(
|
7
|
+
<%= full_application_class_name %>.root.join("db", "data_updates")
|
8
8
|
end
|
9
9
|
|
10
10
|
# Updates will run in production, but not in test an dev.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seed_migrator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arthur Shagall
|
@@ -9,36 +9,48 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-
|
12
|
+
date: 2019-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '4.0'
|
21
|
+
- - "<"
|
19
22
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
23
|
+
version: '6.0'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '4.0'
|
31
|
+
- - "<"
|
26
32
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
33
|
+
version: '6.0'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: activerecord
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
31
37
|
requirements:
|
32
|
-
- - "
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.0'
|
41
|
+
- - "<"
|
33
42
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
43
|
+
version: '6.0'
|
35
44
|
type: :runtime
|
36
45
|
prerelease: false
|
37
46
|
version_requirements: !ruby/object:Gem::Requirement
|
38
47
|
requirements:
|
39
|
-
- - "
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '4.0'
|
51
|
+
- - "<"
|
40
52
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
53
|
+
version: '6.0'
|
42
54
|
- !ruby/object:Gem::Dependency
|
43
55
|
name: i18n
|
44
56
|
requirement: !ruby/object:Gem::Requirement
|