2012-12-26 27 views
1

db:如果rails应用程序使用sqlite,则迁移将创建文件db/development.sqlite3。在部署到heroku之前,我更愿意使用postgresql进行开发和生产。我的database.yml文件的db:migrate创建文件db/development.sqlite3

部分:

development: 
adapter: postgresql 
encoding: unicode 
host: localhost 
database: app-development 
username: postgres 
password: ******* 

当我运行包的exec耙分贝:迁移我应该期待一个文件,如DB/development.postgresql?因为在db目录中没有创建文件,也没有产生错误。

$ bundle exec rake db:migrate 
== CreateUsers: migrating ==================================================== 
-- create_table(:users) 
NOTICE: CREATE TABLE will create implicit sequence "users_id_seq" for serial column " 
users.id" 
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index "users_pkey" for table 
"users" 
-> 0.2060s 
== CreateUsers: migrated (0.2070s) =========================================== 

回答

0

嘛,postgresql是非常从sqlite很大的不同。尝试阅读本文,以便您可以发现主要区别:

http://saaientist.blogspot.com.br/2007/07/choice-of-databases-or-postgres-vs.html

关于你的问题的事情是,sqlite与你的应用程序文件夹内的数据库文件一起工作,并且postgres不以这种方式工作。关于postgresql如何使用Rails有大量的资源,我建议你阅读一些并尝试理解。