2012-12-26 29 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有大量的資源,我建議你閱讀一些並嘗試理解。