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:
rake db:migrate
command from a remote host was not working. This may be possible but I was not able to figure it out.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.
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
Update 3: Solution I have resolved this and wanted to share my learnings:
Hopefully this helps.
ActiveRecord::Tasks::DatabaseTasks::LOCAL_HOSTS << "192.168.1.1" # Replace with the IP you want to connect from
请记住,这是一个肮脏的 hack,它可能随时停止工作,因为它改变了一个实际上更适合私有的常量。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.