“MUL”是可接受的“主键”吗?

问题描述:

我正在尝试使用ActiveUUID gem来使我的Survey表的主键成为UUID。 (MySQL)“MUL”是可接受的“主键”吗?

即使我有:primary_key => true由于某些原因它仍然将它设置为MUL?这是预期的吗?

迁移:

class CreateSurveys < ActiveRecord::Migration 
    def change 
    create_table :surveys, :id => false do |t| 
     t.references :employee, :null => false 

     t.uuid :id, :primary_key => true 
     t.datetime :expired_at 

     t.timestamps 
    end 
    add_index :surveys, :id 
    end 
end 

型号:survey.rb

class Survey < ActiveRecord::Base 

    include ActiveUUID::UUID 

    belongs_to :employee 

    validates :employee, :presence => true 

end 

我找到了答案。我需要删除add_index :surveys, :id。显然,主键已经被编入索引。固定它