mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
updating generators
This commit is contained in:
parent
c1a63c8dba
commit
4d35f8b661
3 changed files with 6 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
class <%= migration_class_name %> < ActiveRecord::Migration
|
||||
def self.up
|
||||
def up
|
||||
<% attributes.each do |attribute| -%>
|
||||
<%- if migration_action -%>
|
||||
<%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end %>
|
||||
|
@ -7,7 +7,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|||
<%- end -%>
|
||||
end
|
||||
|
||||
def self.down
|
||||
def down
|
||||
<% attributes.reverse.each do |attribute| -%>
|
||||
<%- if migration_action -%>
|
||||
<%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class <%= migration_class_name %> < ActiveRecord::Migration
|
||||
def self.up
|
||||
def up
|
||||
create_table :<%= table_name %> do |t|
|
||||
<% for attribute in attributes -%>
|
||||
t.<%= attribute.type %> :<%= attribute.name %>
|
||||
|
@ -10,7 +10,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
def down
|
||||
drop_table :<%= table_name %>
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class <%= migration_class_name %> < ActiveRecord::Migration
|
||||
def self.up
|
||||
def up
|
||||
create_table :<%= session_table_name %> do |t|
|
||||
t.string :session_id, :null => false
|
||||
t.text :data
|
||||
|
@ -10,7 +10,7 @@ class <%= migration_class_name %> < ActiveRecord::Migration
|
|||
add_index :<%= session_table_name %>, :updated_at
|
||||
end
|
||||
|
||||
def self.down
|
||||
def down
|
||||
drop_table :<%= session_table_name %>
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue