maxlapshin / mysql2postgres

Mysqldump, writing in postgresql format
MIT License
711 stars 156 forks source link

Lots of issues making mysql2postgres unable to work on Windows 10 #96

Open Pierstoval opened 7 years ago

Pierstoval commented 7 years ago

Env:

Microsoft Windows [version 10.0.14393]
> ruby --version
ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
> gem --version
2.6.11
> bundle --version
Bundler version 1.14.6

I tried to execute the following to install mysql2postgres:

> bundle install
Using rake 10.5.0
Using public_suffix 2.0.5
Using builder 3.2.3
Using thread_safe 0.3.6
Using multipart-post 2.0.0
Using git 1.3.0
Using hashie 3.5.5
Using multi_json 1.12.1
Using mini_portile2 2.1.0
Using jwt 1.5.6
Using multi_xml 0.6.0
Using rack 2.0.1
Using highline 1.7.8
Using bundler 1.14.6
Using psych 2.2.4
Using rdoc 5.1.0
Using semver2 3.4.2
Using mysql-pr 2.9.11
Using postgres-pr 0.7.0
Using test-unit 2.5.5
Using addressable 2.5.1
Using descendants_tracker 0.0.4
Using faraday 0.9.2
Using nokogiri 1.6.8.1 (x64-mingw32)
Using oauth2 1.3.1
Using github_api 0.11.3
Using jeweler 2.3.3
Bundle complete! 10 Gemfile dependencies, 27 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

> gem build mysqltopostgres.gemspec
Successfully built RubyGem
Name: mysqltopostgres
Version: 0.3.0
File: mysqltopostgres-0.3.0.gem

> gem install mysqltopostgres-0.3.0.gem
Successfully installed mysqltopostgres-0.3.0
Parsing documentation for mysqltopostgres-0.3.0
Done installing documentation for mysqltopostgres after 0 seconds
1 gem installed

When using compiled binary:

> mysqltopostgres
e:/dev/ruby2.3/lib/ruby/gems/2.3.0/gems/mysqltopostgres-0.3.0/lib/mysqltopostgres.rb:7:in `require': cannot load such file -- pg_ext (LoadError)
    from e:/dev/ruby2.3/lib/ruby/gems/2.3.0/gems/mysqltopostgres-0.3.0/lib/mysqltopostgres.rb:7:in `<top (required)>'
    from e:/dev/ruby2.3/lib/ruby/gems/2.3.0/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:7:in `require'
    from e:/dev/ruby2.3/lib/ruby/gems/2.3.0/gems/mysqltopostgres-0.3.0/bin/mysqltopostgres:7:in `<top (required)>'
    from e:/dev/ruby2.3/bin/mysqltopostgres:22:in `load'
    from e:/dev/ruby2.3/bin/mysqltopostgres:22:in `<main>'

When using bundle exec:

> bundle exec mysqltopostgres
e:/dev/ruby2.3/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/rubygems_integration.rb:408:in `block in replace_bin_path': can't find executable mysqltopostgres (Gem::Exception)
    from e:/dev/ruby2.3/lib/ruby/gems/2.3.0/gems/bundler-1.14.6/lib/bundler/rubygems_integration.rb:425:in `block in replace_bin_path'
    from e:/dev/ruby2.3/bin/mysqltopostgres:22:in `<main>'

And I even tried using the bundled binary in the repository itself:

> ruby bin\mysqltopostgres
E:/dev/www/mysql2postgres/lib/mysqltopostgres.rb:7:in `require': cannot load such file -- pg_ext (LoadError)
    from E:/dev/www/mysql2postgres/lib/mysqltopostgres.rb:7:in `<top (required)>'
    from bin/mysqltopostgres:7:in `require'
    from bin/mysqltopostgres:7:in `<main>'

I am no ruby dev, and these dependency seem to be a bit tough to handle (maybe that's why I'm no ruby dev).

I spent a whole day on this, and you know, time is money, and I couldn't spend more time on this, like any other guy coming from Heroku would do.

Can anyone say what's going on and what's needed to finally install this app, because it's linked in Heroku docs to migrate from mysql to postgresql đŸ˜•

pooja-malvi259 commented 7 years ago

Facing the same issue.

psusmars commented 7 years ago

It has to do with the pg gem and making sure it was able to install. I'm not 100% sure why the gem wasn't installed as part of your bundle install command, but you'll want to make sure "gem install pg" works before trying to use this gem. To have that work, you'll need to make sure your libpq.dll is in PATH and that you have the correct version in PATH.