Skip to content

Instantly share code, notes, and snippets.

@niqbal
Created July 19, 2011 23:03
Show Gist options
  • Save niqbal/1093965 to your computer and use it in GitHub Desktop.
Save niqbal/1093965 to your computer and use it in GitHub Desktop.
heroku db:pull/:push on windows

I just went through exporting and importing database on windows. There were few hiccups which I wanted to log, lest I forget:-

"heroku db:pull" pulls heroku data down into local database; while "heroku db:push" pushes data from local database to the application.

Dependencies

mysql 5.5 (32 bit version running on windows 64 bit)

heroku (version 2.3.6)

ruby 1.9.2

Ruby Gems

taps (0.3.23) (Instally taps also installs few other required gems, i.e. sequel etc.)

mysql (2.8.1 x86-mingw32)

MySql bug

mysql gem uses libmysql.dll; so copy that dll from [your-sql-location]\bin to [your-ruby-location]\bin; I discovered that there is some bug in mysql 5.1 onwards. So, I had to download older no-install version 5.0.84 and only copied the lib\libmysql.dll file into the ruby location.

DATABASE_URL

This is heroku style database url. So mysql url will be: mysql://user@password@localhost:3306/test

After that, I was successfully able to upload few rows to my app: I specified only one table for upload (computer).

heroku db:push

heroku db:push mysql://root:root@localhost:3306/test -t computer

Loaded Taps v0.3.23
Warning: Data in the app 'cargo-tomcat-mongo' will be overwritten and will not be recoverable.

 !    WARNING: Potentially Destructive Action
 !    This command will affect the app: cargo-tomcat-mongo
 !    To proceed, type "cargo-tomcat-mongo" or re-run this command with --confirm cargo-tomcat-mongo

> cargo-tomcat-mongo
Sending schema
Schema:        100% |==========================================| Time: 00:00:05
Sending indexes
Sending data
1 tables, 3 records
computer:      100% |==========================================| Time: 00:00:00
Resetting sequences

heroku db:pull

heroku db:pull mysql://root:root@localhost:3306/test -t computer

Loaded Taps v0.3.23
Warning: Data in the database 'mysql://root:root@localhost:3306/test' will be overwritten and will not be recoverable.

 !    WARNING: Potentially Destructive Action
 !    This command will affect the app: cargo-tomcat-mongo
 !    To proceed, type "cargo-tomcat-mongo" or re-run this command with --confirm cargo-tomcat-mongo

> cargo-tomcat-mongo
Receiving schema
Schema:          0% |                                          | ETA:  --:--:--
Schema:        100% |==========================================| Time: 00:00:04
Receiving indexes
Receiving data
1 tables, 200 records
computer:      100% |==========================================| Time: 00:00:00
Resetting sequences
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment