[英]Why do created_at/updated_at get created when migration does not have timestamps?
I'm using rails 3.2 with the following migration and created_at/updated_at both get generated. 我正在使用Rails 3.2进行以下迁移,并且都生成了created_at / updated_at。 I was under the impression that adding t.timestamps was what caused those columns to get generated.
我的印象是,添加t.timestamps是导致生成这些列的原因。
class CreateContactsCountries < ActiveRecord::Migration
def change
create_table :contacts_countries do |t|
t.string :name, :official_name, :null => false
t.string :alpha_2_code, :null => false, :limit => 2
t.string :alpha_3_code, :null => false, :limit => 3
end
add_index :contacts_countries, :alpha_2_code
end
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.