Sha256: 911b88afc928074498d16b23294d471e69605bd9b380086183b73396b107dfad

Contents?: true

Size: 831 Bytes

Versions: 7

Compression:

Stored size: 831 Bytes

Contents

# -*- encoding : utf-8 -*-
class Alter<%= @all_entities.select{|e| e.resource?}.collect{|e| e.file_name.camelize}.join('') %><%= @random_migration_key %> < ActiveRecord::Migration
  
  def self.up
  <%- @changes.each do |change| -%>
    <%= change[:type] %> :<%= MDWA::Generators::Model.new(change[:entity].model_name).plural_name %>, :<%= change[:column] %> <%= ", :#{change[:attr_type]}" unless change[:attr_type].blank? %>
  <%- end -%>
  end
  
  def self.down
    <%- @changes.each do |change| -%>
      <%= inverse_migration_type change[:type] %> :<%= MDWA::Generators::Model.new(change[:entity].model_name).plural_name %>, :<%= change[:column] %> <%= ", :#{change[:attr_type]}" if inverse_migration_type(change[:type]) == 'add_column' %> <%= ", :#{change[:from]}" unless change[:from].blank? %>
    <%- end -%>
  end
  
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mdd-3.0.10 lib/generators/mdwa/code/templates/migration.rb
mdd-3.0.9 lib/generators/mdwa/code/templates/migration.rb
mdd-3.0.8 lib/generators/mdwa/code/templates/migration.rb
mdd-3.0.7 lib/generators/mdwa/code/templates/migration.rb
mdd-3.0.6 lib/generators/mdwa/code/templates/migration.rb
mdd-3.0.4 lib/generators/mdwa/code/templates/migration.rb
mdd-3.0.3 lib/generators/mdwa/code/templates/migration.rb