Sha256: 7b948f77f9b228e386a039fd00cd011f74f16e2949c6edb72f307e11f0923eb1

Contents?: true

Size: 734 Bytes

Versions: 7

Compression:

Stored size: 734 Bytes

Contents

class <%= class_name.underscore.camelize %> < ActiveRecord::Migration
  ############################################################
  # Database migration targeting the Secondbase!
  # Generated using: ./script/generator secondbase_migration [ModelName]
  
  def self.up<% attributes.each do |attribute| %>
    <%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%>
  <%- end %>
  end

  def self.down<% attributes.reverse.each do |attribute| %>
    <%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end -%>
  <%- end %>
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
secondbase-0.6.0 rails_generators/secondbase/templates/migration.rb
secondbase-0.5.0 rails_generators/secondbase/templates/migration.rb
secondbase-0.4.3 rails_generators/secondbase/templates/migration.rb
secondbase-0.4.2 rails_generators/secondbase/templates/migration.rb
secondbase-0.4.1 rails_generators/secondbase/templates/migration.rb
secondbase-0.4.0 rails_generators/secondbase/templates/migration.rb
secondbase-0.3.3 rails_generators/secondbase/templates/migration.rb