I have a postgres database with 40 tables residing on Heroku right now. It's a Django app, and overall rows are roughly 5 million.
I want to migrate all that to an exact replica in an Azure VM (which already has postgres correctly installed and set up).
What's the safest, cleanest way to make this migration?
Here are the steps in my head:
1) Prepare the Azure VM, by:
switching to user
postgres
and going to psql client via typingpsql
creating a database called
mydatabase
via the commandCREATE DATABASE mydatabase;
no need to run
syncdb
to create tables at this stage.
2) Log onto the Heroku commandline, and run the command heroku maintenance:on
3) Next, run the command heroku run pg_dump -C dbname | bzip2 | ssh myusername@hostname "bunzip2 | psql mydatabase"
(source: here)
That's it. No syncdb to create table structures or anything at any point.
Can anyone comment on those steps, and rectify wherever needed? Thanks!
Note: ask for more information in case you need it