Schema.rb不了解SQLite虚拟表

时间:2011-11-14 01:51:21

标签: ruby-on-rails sqlite full-text-search

我正在使用sqlite的FTS4全文搜索功能。 FTS表是使用CREATE VIRTUAL TABLE fts_foo USING fts4();通过raw-sql迁移创建的。执行此操作时,SQLite实际上会创建多个表fts_foofts_foo_contentfts_foo_docsizefts_foo_segdirfts_foo_segmentsfts_foo_stat,以及fts_foo_segdir列的索引。

但是,schema.rb无法理解这些列并输出以下内容

# Could not dump table "fts_foo" because of following StandardError
#   Unknown type '' for column 'content'

# Could not dump table "fts_foo_content" because of following StandardError
#   Unknown type '' for column 'c0content'

create_table "fts_foo_docsize", :primary_key => "docid", :force => true do |t|
  t.binary "size"
end

create_table "fts_foo_segdir", :primary_key => "level", :force => true do |t|
  t.integer "idx"
  t.integer "start_block"
  t.integer "leaves_end_block"
  t.integer "end_block"
  t.binary  "root"
end

add_index "fts_foo_segdir", ["level", "idx"], :name => "sqlite_autoindex_fts_foo_segdir_1", :unique => true

create_table "fts_foo_segments", :primary_key => "blockid", :force => true do |t|
  t.binary "block"
end

create_table "fts_foo_stat", :force => true do |t|
  t.binary "value"
end

我认为不应该在schema.rb中创建任何这些表。它应该只创建一个虚拟表,让sqlite构建支持表。有什么方法可以做到这一点吗?如果没有,什么样的解决方案会促进这个?

0 个答案:

没有答案