modular_migration 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +2 -1
- data/lib/modular_migration/active_record/generators/migration_generator.rb +5 -5
- data/lib/modular_migration/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6dbd152558bf5cb35d9e355e41b5bfdde0c0892
|
4
|
+
data.tar.gz: 834e4e4517ff2fb748dbca32f393b3a6b68dbfce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42049d9862d53b5c8f5d986f97dd6fd94e6e377df214e2461e9e1e2a13b0000877b70cd928c043ed4bce52cb499b547f7098ad88afa3195d5ab4a3ec9a750b8f
|
7
|
+
data.tar.gz: 283d84e139de7e215c24b150a90d2bd6ba96417980817203ae2dec18e05782da40caf64316dbaf251b3b03799db13f70cb5f624a0379823447b5a690387b3f48
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -44,7 +44,8 @@ Do nothing.
|
|
44
44
|
|
45
45
|
## Credits
|
46
46
|
|
47
|
-
- [LiJia.Tong](https://github.com/user-tony/) @[
|
47
|
+
- [LiJia.Tong](https://github.com/user-tony/) @[ihaveu](https://www.ihaveu.com/home)
|
48
|
+
- [swordray](https://github.com/swordray) @[ihaveu](http://www.ihaveu.com/home) @[shuhai](http://tw.shuhai.org/) @[leaf](http://leaf.iacger.com)
|
48
49
|
|
49
50
|
## License
|
50
51
|
|
@@ -4,7 +4,7 @@ module ActiveRecord
|
|
4
4
|
|
5
5
|
def create_migration_file
|
6
6
|
set_local_assigns!
|
7
|
-
validate_file_name!
|
7
|
+
validate_file_name! if self.respond_to?(:validate_file_name)
|
8
8
|
if migration_action.match(/(add|remove)/)
|
9
9
|
table = table_name.singularize
|
10
10
|
modular = table.gsub(/_/, '/').camelize.safe_constantize
|
@@ -21,12 +21,12 @@ module ActiveRecord
|
|
21
21
|
migration = modular ? modular.to_s.underscore : []
|
22
22
|
end
|
23
23
|
migration = join_tables.map(&:singularize).join('_') if migration_action.match(/join/)
|
24
|
-
migration = FileUtils.mkdir_p("db
|
24
|
+
migration = FileUtils.mkdir_p(File.join("db", "migrate", migration)) if migration
|
25
25
|
migration_file = File.join(migration.join('/'), "#{file_name}.rb")
|
26
|
-
|
27
|
-
|
26
|
+
template_file = Rails.version.to_i < 4 ? 'migration.rb' : '../../migration/templates/create_table_migration.rb'
|
27
|
+
migration_template template_file, migration_file
|
28
|
+
end
|
28
29
|
|
29
30
|
end
|
30
31
|
end
|
31
32
|
end
|
32
|
-
|