Converting MySQL to PostgreSQL

If you working with mysql and loading database with "rake db:structure:load"
Then later you want migrate from mysql to postgres then "rake db:structure:load" command will not work with Postgres,you will need to convert sql to postgres

Blow are the commands which directly insert .sql file into PG databse then you can create .dump file from postgres which can be use on heroku.
Export .sql from mysql
mysqldump -u username -p --compatible=postgresql databasename > data.sql
Import .sql into Postgres
psql -h server -d databasename -U username -f data.sql

Then you can create dump file from PG
pg_dump databasename > outfile.dump
Now you can push this dump file on heroku also.
Thanks

Comments

Popular Posts

How to pass hash in Postman

nginx: unrecognized service

Bootstrap Select Picker append add new item if search not exist

Reading Excel Sheets using "Roo" gem in ruby on rails

Add CORS to Nginx on AWS Elastic Beanstalk

Enable gzip compression on Elastic Beanstalk with nginx

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

Get video duration by URL in Ruby on Rails

site-enables nginx setting in ruby in rails