lib/generators/schemaless/migrations/migrations_generator.rb in schemaless-0.0.3 vs lib/generators/schemaless/migrations/migrations_generator.rb in schemaless-0.0.5
- old
+ new
@@ -9,11 +9,11 @@
argument :models, type: :array, default: [] # , banner: 'path'
desc 'Schemaless migration files generator!'
def create_migration_files
Rails.application.eager_load!
- all_tables = Schemaless::Worker.all_tables
+ all_tables = Schemaless::Worker.all_tables.select(&:migrate?)
if models.empty?
tables = all_tables
else
tables = all_tables.select { |t| models.include?(t.model.to_s.downcase) }
end
@@ -45,10 +45,10 @@
return @file_name if @file_name
return "create_#{@table_name}" unless @table.exists?
@file_name = build_file_name.flatten.join('_')
end
- def create_migration_for table
+ def create_migration_for(table)
@table = table
@fields = @table.fields
@indexes = @table.indexes
@table_name = @table.name