Tom*_*ell 39 ruby postgresql ruby-on-rails heroku
所以我在我的Rails应用程序中使用Heroku Postgres,但我不是在Heroku本身上托管我的应用程序.我在我的database.yml中使用了Heroku的Active Record连接详细信息,它看起来像这样:
development:
adapter: postgresql
encoding: unicode
pool: 5
database: [database]
username: [username]
password: [password]
host: ec2-54-227-243-78.compute-1.amazonaws.com
port: 5432
Run Code Online (Sandbox Code Playgroud)
但是,现在我正在尝试使用db:迁移我的应用程序,以便数据库全部使用我的模型进行设置.运行该命令不会做任何事情,所以我尝试了rake db:reset,我得到了这个:
Couldn't drop df2cokjfj0k4vu : #<PG::Error: FATAL: permission denied for database "postgres"
DETAIL: User does not have CONNECT privilege.
Run Code Online (Sandbox Code Playgroud)
df2cokjfj0k4vu已经存在
- initialize_schema_migrations_table()
- > 1.3997s
- assume_migrated_upto_version(20130924040351,["/ home/action/braindb/db/migrate"])
- > 0.0882s
知道我做错了什么.我还是Rails的新手,所以有时我会忘记在迁移主机时如何正确设置Postgres数据库.
lui*_*7up 62
请heroku pg:reset DATABASE改用https://devcenter.heroku.com/articles/rake中所述
rake db:reset因为用户没有权限,所以不能在Heroku中删除数据库.
我最近遇到了这个问题,并通过以下步骤解决了它。
heroku pg --help 获取使用postgres的命令名称
heroku pg:reset DATABASE #重置数据库
回答提示以确认
| 归档时间: |
|
| 查看次数: |
32993 次 |
| 最近记录: |