为什么这个“添加索引迁移”不起作用?

时间:2013-02-05 15:49:14

标签: ruby-on-rails ruby-on-rails-3

我使用下面的迁移文件bundle exec rake db:migrate

在终端上它看起来像这样成功了

==  AddIndexToCommunity: migrating ============================================
-- add_index(:communities, [:community_name, :title, :user_id], {:name=>:communities_idx})
   -> 0.0452s
==  AddIndexToCommunity: migrated (0.0456s) ===================================

但是,如果我查看phpMyAdmin的Structure部分,它将不会显示此迁移生成的索引。
为什么呢?

迁移文件

class AddIndexToCommunity < ActiveRecord::Migration
  def self.up
    add_index :communities, [:community_name, :title, :user_id], :name=>:communities_idx
  end

  def self.down
    remove_index :communities, [:community_name, :title, :user_id], :name=>:communities_idx
  end
end

0 个答案:

没有答案