Skip to content

Conversation

@wojtekmach
Copy link
Member

Closes #684.

On MySQL 9.4+, --execute "SOURCE {path}" is no longer supported.

On MySQL 9.4+, `--execute "SOURCE {path}"` is no longer supported.
@wojtekmach
Copy link
Member Author

@yordis could you try {:ecto_sql, github: "elixir-ecto/ecto_sql", branch: "wm-fix-myxql-structure-load"}?

case run_with_cmd("mysql", config, args) do
{_output, 0} -> {:ok, path}
{output, _} -> {:error, output}
with {:ok, contents} <- File.read(path) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will downstream be able to handle {:error, atom()}?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, yes it handles it:

$ mix ecto.load
** (Mix) The structure for Dummy.Repo couldn't be loaded: :enoent

however previously it was a slightly better error message:

** (Mix) The structure for Dummy.Repo couldn't be loaded: ERROR at line 1: Failed to open file '/Users/wojtek/dummy/priv/repo/structure.sql', error: 2

I will do something like:

      {:error, reason} ->
        {:error, "could not read #{inspect(path)}: #{:file.format_error(reason)}"}

so that we have:

** (Mix) The structure for Dummy.Repo couldn't be loaded: could not read "/Users/wojtek/dummy/priv/repo/structure.sql": no such file or directory

Copy link
Contributor

@yordis yordis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran the test locally, with mysql-client@9.4 and it is passing now.

Thank y'all!

@wojtekmach wojtekmach merged commit e223a37 into master Aug 13, 2025
22 checks passed
@wojtekmach wojtekmach deleted the wm-fix-myxql-structure-load branch August 13, 2025 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mysql-client@9.4 fails to run ecto.load

4 participants