0

I have an app that I am migrating to Deis and want to use RDS for my Postgres instance. I have Postgres set up but if i run rake db:create:all from my local machine, configured to point to RDS, I get:

This task only modifies local databases. <db_name> is on a remote host.

Is there a way to create the DB from an existing migration or the schema.rb file?

Update 1 Here is the database.yml file. All environments inherit the default

default: &default
adapter: postgresql
encoding: utf8
pool: 5
username: <db user I created>
password: <PW>
host: <my_unique_host>.us-east-1.rds.amazonaws.com
port: 5432

Update 2 For the comment about just creating the DB then running db:migrate like normal, this is exactly the behavior I am not seeing. If I have the DB active and run rake db:migrate, the process completes and I am presented a new terminal line. No tables/columns are created.

Am I better off trying to do a local DB dump and restoring it into RDS?

Update 3: Solution I have resolved this and wanted to share my learnings:

  1. It appears that running the rake db:migrate command from a remote host was not working. This may be possible but I was not able to figure it out.
  2. What solved it was actually SSH'ing into the app container in the Deis cluster and running rake db:create and rake db:migrate. This ack'd back saying the table was created and I was able to verify in the psql prompt.

Hopefully this helps.

1
  • 1
    Can you post your database.yml? Commented Sep 19, 2015 at 1:17

3 Answers 3

2

You will have to do manually the part done by rake db:create:all[1], so connect to the DBMS and create the db by running command

CREATE DATABASE db_name CHARACTER SET utf8;

migration can be done in normal way via rake db:migrate

Sign up to request clarification or add additional context in comments.

1 Comment

See my second update above. This does not seem to do anything.
2

Update 3: Solution I have resolved this and wanted to share my learnings:

  1. It appears that running the rake db:migrate command from a remote host was not working. This may be possible but I was not able to figure it out.
  2. What solved it was actually SSH'ing into the app container in the Deis cluster and running rake db:create and rake db:migrate. This ack'd back saying the table was created and I was able to verify in the psql prompt.

Hopefully this helps.

Comments

0
ActiveRecord::Tasks::DatabaseTasks::LOCAL_HOSTS << "192.168.1.1" # Replace with the IP you want to connect from

P.S. Keep in mind, it is a dirty hack which may stop working anytime, since it alters a constant.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.