Pergunta

I've been given access to Heroku application with rather strange setup. It has one database but when I run heroku config, I get different DATABASE_URL and HEROKU_POSTGRESQL_BRONZE_URL. When I run heroku pg:info I get the following result:

=== HEROKU_POSTGRESQL_BRONZE_URL
Plan:        Dev
Status:      available
Connections: 1
PG Version:  9.2.4
Created:     2013-09-05 11:02 UTC
Data Size:   6.5 MB
Tables:      0
Rows:        0/10000 (In compliance)
Fork/Follow: Unsupported

I realised that my database is at DATABASE_URL, but I can't access that database, only through heroku run console. All heroku pg commands fail with this message:

!    Unknown database: DATABASE_URL. Valid options are: HEROKU_POSTGRESQL_BRONZE_URL

If I run heroku pg HEROKU_POSTGRESQL_BRONZE_URL, I get access to empty database from above.

Since I have some issues with running migrations, I think my database might be full, and I'd like to check it. Any ideas how I can do that?

Here's the error after I run heroku run rake db:migrate:

PG::Error: ERROR:  permission denied for relation schema_migrations
: INSERT INTO "schema_migrations" ("version") VALUES ('20130918114202')

More information about the setup:

rails 3.2.12

RAILS_ENV: staging (I don't have access to production, but I know this is "dev" server and there's also real "staging" from which this app was forked).

Foi útil?

Solução 2

This seems like something screwy on the Heroku side. Have you tried submitting a ticket with them? I've always had good luck with their support.

Outras dicas

I have same problem and i fixed it:

Just Keep a Backup from your database and restore it back again, here is the steps:

heroku pg:info                 <-- to get the Database Name
heroku addons:add pgbackups    <-- make sure you have the addons for backup
heroku pgbackups:capture       <-- Capture the backup
heroku pgbackups               <-- check your backups and make sure its there 
heroku pg:reset  DATABASE_NAME <-- Reset your database don't worry we have a backup, replace DATABASE_NAME with database name
heroku pgbackups:restore DATABASE_NAME b001 <-- Restore the backup again, replace DATABASE_NAME with database name and b001 with your Database version you can see this version number in heroku pgbackups step
heroku run rake db:migrate     <-- Now you can run your migration and Operate in normal mode. 

I just got an update from my client. Before, I couldn't drop the database, because of the data in it. At the end, we decided to drop the database since the data can be added back (it's dev server, doesn't matter if we loose some dummy data).

I didn't find a solution for the problem above, but promoting HEROKU_POSTGRESQL_BRONZE_URL and restoring from backup solved the issue about not being able to access the database.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top