Search code examples
ruby-on-railspostgresqlactiverecordvpsdatabase-migration

Postgres database says database exist but I cannot Alter owner


This is my first VPS and first rails project ever.

Inside of postgres console:

postgres=# \list
                                     List of databases
      Name       |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------------+----------+----------+-------------+-------------+-----------------------
 blog_production | blog     | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres        | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0       | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                 |          |          |             |             | postgres=CTc/postgres
 template1       | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
                 |          |          |             |             | postgres=CTc/postgres
(4 rows)

postgres=# ALTER DATABASE blog_development OWNER TO watashi;
ERROR:  database "blog_development" does not exist

How can it not exist when it obviously is on the list? How can I drop this database? and if I can it hurt my vps?

Link to site is: www.morningharwood.com it doesnt error out until www.morningharwood.com/works


Solution

  • Rails can't find the works table, it should have been created as part of your RAILS_ENV=production bundle exec rake db:migrate command, what was the output of that?

    Also check that you are running the rails server in production mode.