I've manually created a database in MySQL:
mysql> create database sample_app_development;
Query OK, 1 row affected (0.01 sec)
Ran this to test:
rake db:create
sample_app_development already exists
Got error when I when I ran rake thinking_sphinx:index
rake aborted!
Table 'sample_app_development.users' doesn't exist
How does the table not exist when it says that I have just created 开发者_开发问答one and that it does exist?
As pointed out in Jergason's answer - you've only created the database, not all the tables. If this is an app you're loading for the first time, then you'll probably want to run the following command to load the full schema:
rake db:schema:load
Otherwise, to update to the latest schema via migrations:
rake db:migrate
The database named sample_app_development
exists, but are you sure the table users
is created when you run the rake task? The code you show will just create the database, not the tables inside it.
精彩评论