我正在尝试运行 rails 迁移,我看到错误“BLOB/TEXT column used in key specification without a key length”...但是,我在迁移类中指定了长度。从迁移生成 SQL 语句时,Rails 似乎忽略了这一点。有什么线索吗?
这是我的迁移课程:
class AddIndexToAccounts < ActiveRecord::Migration
def self.up
add_index :TACCOUNT, :NAMEX, :length => 5
end
def self.down
remove_index :TACCOUNT, :NAMEX
end
end
这是错误输出。它似乎已经看到了长度规范,但它不存在于它生成的 SQL 语句中:
** [out :: 192.168.10.7] -- add_index(:TACCOUNT, :NAMEX, {:length=>5})
** [out :: 192.168.10.7] rake aborted!
** [out :: 192.168.10.7] An error has occurred, all later migrations canceled:
** [out :: 192.168.10.7]
** [out :: 192.168.10.7] Mysql::Error: BLOB/TEXT column 'NAMEX' used in key specification without a key length: CREATE INDEX `index_TACCOUNT_on_NAMEX` ON `TACCOUNT` (`NAMEX`)