Ruby ActiveRecord 增加primary key
2019-12-11 本文已影响0人
ifree321
https://thinkwhere.wordpress.com/2009/05/09/adding-a-primary-key-id-to-table-in-rails/
def self.up
add_column :table_name, :id, :primary_key
end
def self.down
remove_column :table_name, :id
end