elixir-ecto / ecto

A toolkit for data mapping and language integrated query.
https://hexdocs.pm/ecto
Apache License 2.0
6.19k stars 1.43k forks source link

Tasks ran with MySQL adapter relies on mysql client binary #1776

Closed rbishop closed 7 years ago

rbishop commented 8 years ago

Environment

Current behavior

When running tasks such as ecto.create and ecto.migrate an exception occurs. Following the stacktrace leads to Ecto.Adapters.MySQL.storage_up/1 and Ecto.Adapters.MySQL.storage_down/2, which are delegating to Ecto.Adapters.MySQL.run_with_mysql/2.

Ecto.Adapters.MySQL.run_with_mysql/2 shells out to the mysql client binary. The problem is that in production environments you typically won't have the MySQL client binary installed on your servers that Ecto will be running tasks from. The common case is that you will have the MySQL client development headers installed (this doesn't matter for us because Mariaex is an Elixir implementation of the MySQL protocol).

Expected behavior

I would expect Ecto to use the Mariaex adapter to run these queries rather than shelling out to the mysql binary.

josevalim commented 8 years ago

Yes, if someone wants to send a pull request, it is welcome. That's what we do for Postgres: https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/adapters/postgres.ex#L189-L223

rbishop commented 8 years ago

I'll take a stab at it. I just wanted to confirm this wasn't the preferred behavior first.

fishcakez commented 7 years ago

@rbishop this would be helpful for me when working on Ecto. If you could find some time to pick this up I would be very grateful.

rbishop commented 7 years ago

@fishcakez We just stopped using MySQL since Postgres is HIPAA certified on AWS RDS now, but I'll try and take care of this anyway. I will try my best in the coming weeks!