WandermyzGoogleCode / tongshare

Automatically exported from code.google.com/p/tongshare
0 stars 0 forks source link

migration 顺序问题 #73

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.rake db:drop
2.rake db:migrate

What is the expected output? What do you see instead?
期待:成功结束
实际:失败,错误发生在add_uid1_and_confirmed_to_user
现在change_renren_url_to_renren_id等migate在加管理员之后,在加管��
�员的时候user_extras表尚不完整

Please use labels and text to provide additional information.

Original issue reported on code.google.com by cbm...@gmail.com on 3 Mar 2011 at 2:44

GoogleCodeExporter commented 9 years ago
#74, #75也适用
http://guides.rubyonrails.org/migrations.html#changing-tables, Chap.5

Frequently I just want to update rows in the database without writing out the 
SQL by hand: I’m not using anything specific to the model. One pattern for 
this is to define a copy of the model inside the migration itself, for example:

 class AddPartNumberToProducts < ActiveRecord::Migration
  class Product < ActiveRecord::Base
  end

  def self.up
    ...
  end

  def self.down
    ...
  end
end
The migration has its own minimal copy of the Product model and no longer cares 
about the Product model defined in the application.

Original comment by lywan...@gmail.com on 3 Mar 2011 at 8:34

GoogleCodeExporter commented 9 years ago
刘洋搞定

Original comment by LiYuqia...@gmail.com on 9 Mar 2011 at 2:11