modular_migration 0.0.3 → 0.0.4
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ee82a97b2247dd6e5cde40b86ffb0aac2aaf90f
|
4
|
+
data.tar.gz: 8a4878a368ad3517f4546989c64a3e815ce21906
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26f02f991699aeb41049128adeaf10b65a81d94f2d9b829b4d4778cc0d4aff2834b5e03d5fb408725aaa82b1c7fd8471f0303a790dd83ba5d1798ac5263fba66
|
7
|
+
data.tar.gz: 133e11c231e6e2bc38a65c8258fe03ad3642779a2570aa324803b91de05026a0842711878456cb67707c65ba0f3050d921ed1fc6464ccb73c12fc117ffe7eb90
|
@@ -5,7 +5,7 @@ module ActiveRecord
|
|
5
5
|
def create_migration_file
|
6
6
|
set_local_assigns!
|
7
7
|
validate_file_name! if self.respond_to?(:validate_file_name)
|
8
|
-
if migration_action.match(/(add|remove)/)
|
8
|
+
if migration_action && migration_action.match(/(add|remove)/)
|
9
9
|
table = table_name.singularize
|
10
10
|
modular = table.gsub(/_/, '/').camelize.safe_constantize
|
11
11
|
table = table.split('_')
|
@@ -20,12 +20,12 @@ module ActiveRecord
|
|
20
20
|
end unless modular
|
21
21
|
migration = modular ? modular.to_s.underscore : []
|
22
22
|
end
|
23
|
-
migration = join_tables.map(&:singularize).join('_') if migration_action.match(/join/)
|
24
|
-
|
25
|
-
migration_file = File.join(migration
|
26
|
-
template_file = Rails.version.to_i < 4 ? 'migration.rb' :
|
23
|
+
migration = join_tables.map(&:singularize).join('_') if migration_action && migration_action.match(/join/)
|
24
|
+
FileUtils.mkdir_p(File.join("db", "migrate", migration)) if migration
|
25
|
+
migration_file = File.join("db", "migrate", migration||"", "#{file_name}.rb")
|
26
|
+
template_file = Rails.version.to_i < 4 ? 'migration.rb' : @migration_template
|
27
27
|
migration_template template_file, migration_file
|
28
|
-
end
|
28
|
+
end
|
29
29
|
|
30
30
|
end
|
31
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modular_migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lijia Tong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|