我的应用程序使用Heroku,它需要PostgreSQL,但您仍然可以使用SQLite3进行开发.由于Heroku强烈建议不要使用两个不同的数据库,我决定改用PostgreSQL进行开发.我安装了gem pg
,还go 了PostgreSQL官方网站获取Windows安装程序,还更改了我的database.yml
.在安装过程中,它需要PostgreSQL的密码,所以我做了一个.
# TYPE DATABASE USER ADDRESS METHOD
# IPv4 local connections:
host all all 127.0.0.1/32 trust # was md5
# IPv6 local connections:
host all all ::1/128 trust # was md5
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
但在摆脱了它之后,我现在明白了:
$ rake db:create
(in C:/app)
FATAL: role "User" does not exist
Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"utf8",
"database"=>"app_test", "pool"=>5, "username"=>nil, "password"=>nil}
我还有我的development.sqlite3
和text.sqlite3
礼物,这是问题吗?必须做什么?
以下是我的全部要点:https://gist.github.com/1522188