modular_migration 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6dbd152558bf5cb35d9e355e41b5bfdde0c0892
4
- data.tar.gz: 834e4e4517ff2fb748dbca32f393b3a6b68dbfce
3
+ metadata.gz: 1d8a580651c7729d0f976a2cd7fc53443d121bda
4
+ data.tar.gz: 80d89150e42955680d6c7c1eb757c9dc225ec712
5
5
  SHA512:
6
- metadata.gz: 42049d9862d53b5c8f5d986f97dd6fd94e6e377df214e2461e9e1e2a13b0000877b70cd928c043ed4bce52cb499b547f7098ad88afa3195d5ab4a3ec9a750b8f
7
- data.tar.gz: 283d84e139de7e215c24b150a90d2bd6ba96417980817203ae2dec18e05782da40caf64316dbaf251b3b03799db13f70cb5f624a0379823447b5a690387b3f48
6
+ metadata.gz: 77fbcb863e9ed637a4f2cff044a1c200efeac70c379c650d785ed8b8e2c0a534c6d8f70103134023b87f25cd3795d01984977c3182e53e83f55e825f5ad3cc7c
7
+ data.tar.gz: 204336294daaff1f0b4ea8baa3bb958ba5313072d88e4a880978c929103d0aadd8e96738640af5d16a39c5ff440da8efd98082d4fede77e2cc098697f8b9725d
@@ -2,7 +2,12 @@ module ActiveRecord
2
2
  module Generators # :nodoc:
3
3
  class ModelGenerator < Base # :nodoc:
4
4
 
5
- def create_modular_migration_file
5
+ class_option :migration, type: :boolean, default: true
6
+ class_option :timestamps, type: :boolean, default: true
7
+
8
+ def create_migration_file
9
+ return unless options[:migration] && options[:parent].nil?
10
+ attributes.each { |a| a.attr_options.delete(:index) if a.reference? && !a.has_index? } if options[:indexes] == false
6
11
  template_file = Rails.version.to_i < 4 ? 'migration.rb' : '../../migration/templates/create_table_migration.rb'
7
12
  migration_file = File.join(FileUtils.mkdir_p(File.join('db/migrate', class_path.join('/'), file_name)), "/create_#{table_name}.rb")
8
13
  migration_template template_file, migration_file
@@ -1,3 +1,3 @@
1
1
  module ModularMigration
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  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.2
4
+ version: 0.0.3
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-03-26 00:00:00.000000000 Z
11
+ date: 2014-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails