I am working with a Rails 4 app, I am using PSQL both in my development and production. Due to some reason I have to work with a new computer/laptop so I set up Rails environment in it and cloned my app into it, but what I really require is that, I need my existing databse with data in it, how to do it ?
Asked
Active
Viewed 20 times
1 Answers
1
To do this you need to create a dump on system 1 and restore it on system 2, here are the steps:
sudo -u postgres pg_dump <DB_NAME> > dump
- creating a filedump
- Copy this file via dropbox or whatever to another system.
sudo -u postgres psql <DB_NAME> < dump
- copy the new created dump to new system.
Note:
You should have empty created database on your new system, or you can use dataonly dump passing the --data-only
to pg_dump
command.
Also you can read documentation for pg_dump to find any other options which you might need.
-
Thanks for the answer buddy – Praveen George Feb 02 '16 at 09:45