kipcole9 / money_sql

Money functions for the serialization of a money data type in Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Couldn't generate migration for custom type due to incorrect path

KungPaoChicken opened this issue · comments

Hello,

First of all thanks for the package!

I have encountered an error when generating the migration using mix money.gen.postgres.migration. This is returned on my machine (Windows 10, Erlang/OTP 22, Elixir 1.8.2 compiled with Erlang/OTP 20):

> mix money.gen.postgres.migration
* creating priv/repo/migrations
** (File.Error) could not read file "c:/my_app/_build/dev/lib/ex_money/priv/SQL/postgres/create_money_with_currency.sql": no such file or directory
    (elixir) lib/file.ex:353: File.read!/1
    lib/mix/tasks/money_postgres_migration.ex:62: Mix.Tasks.Money.Gen.Postgres.Migration.migration_template/1
    lib/mix/tasks/money_postgres_migration.ex:39: anonymous fn/2 in Mix.Tasks.Money.Gen.Postgres.Migration.run/1
    (elixir) lib/enum.ex:769: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:769: Enum.each/2
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2
    (elixir) lib/code.ex:767: Code.require_file/2

I believe that the package could not find the file since it looked in ex_money instead of ex_money_sql, possibly following the package split, so I worked around it by copying priv/ from ex_money_sql to ex_money. I am very new to Elixir so I don't know how to fix it in code, but I hope this helps :)

+1, same problem with mix task looking in ex_money dir:

** (File.Error) could not read file "_build/dev/lib/ex_money/priv/SQL/postgres/create_money_with_currency.sql": no such file or directory

@KungPaoChicken, @njwest Apologies, I only just saw this issue (I'll check my GitHub notifications). I'll have this fixed in the next 24 hours.

No worries, it is a tiny issue which has an easy workaround :)

I have the fix developed. I'm just implementing a much delayed set of tests for migrations and db operations, should be done in the next 24 hours. Thanks for your patience.

I have pushed a new release and published version 1.1.0 to hex that I believe resolves this issue, and that of #2.