Froze rails gems
[depot.git] / vendor / rails / railties / lib / rails_generator / generators / components / migration / templates / migration.rb
diff --git a/vendor/rails/railties/lib/rails_generator/generators/components/migration/templates/migration.rb b/vendor/rails/railties/lib/rails_generator/generators/components/migration/templates/migration.rb
new file mode 100644 (file)
index 0000000..ca35a43
--- /dev/null
@@ -0,0 +1,11 @@
+class <%= class_name.underscore.camelize %> < ActiveRecord::Migration
+  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