当我尝试迁移Thinking Sphinx索引时,为什么rake任务会被中止?

时间:2011-09-11 03:14:49

标签: mysql ruby-on-rails-3 thinking-sphinx

我在MySQL中手动创建了一个数据库:

mysql> create database sample_app_development;
Query OK, 1 row affected (0.01 sec)

跑吧测试:

rake db:create
sample_app_development already exists

当我跑rake thinking_sphinx:index

时出错
rake aborted!
Table 'sample_app_development.users' doesn't exist

如果表中我刚刚创建了一个表并且它确实存在,那么该表是如何存在的?

2 个答案:

答案 0 :(得分:1)

名为sample_app_development的数据库存在,但是您确定在运行rake任务时创建了表users吗?您显示的代码将只创建数据库,而不是其中的表。

答案 1 :(得分:1)

正如Jergason的回答所指出的那样 - 你只创建了数据库,而不是所有的表。如果这是您第一次加载的应用程序,那么您可能希望运行以下命令来加载完整模式:

rake db:schema:load

否则,要通过迁移更新到最新架构:

rake db:migrate