Wil*_*nes 13 migration postgresql ruby-on-rails tsvector custom-data-type
我目前正在运行Rails迁移,我正在添加一个特定于Postgres,tsvector的数据类型.它以Postgres期望的内置文本搜索功能的形式保存搜索信息.
这是我迁移的一行:
t.column "search_vectors", :tsvector
Run Code Online (Sandbox Code Playgroud)
一切似乎都运行正常,搜索也适用.但是,当我打开schema.rb时,这就是我得到的:
Could not dump table "users" because of following StandardError
Unknown type 'tsvector' for column 'search_vectors'
Run Code Online (Sandbox Code Playgroud)
这使我无法在用户表上运行单元测试,并且鉴于schema.rb应该是我的数据库的权威定义,这也让我觉得非常危险.
我注意到有许多Rails插件似乎使用了像我期望的那样存储tsvector的相同方法,例如tsearchable.我真的只是坚持没有测试,没有我的数据库的权威定义?
Wil*_*nes 13
对于在此页面中发生的任何人,仅供参考,我通过将此(实际上取消注释)添加到我的Rails配置来修复此问题:
config.active_record.schema_format =:sql
| 归档时间: |
|
| 查看次数: |
2630 次 |
| 最近记录: |