kipcole9 / money_sql

Money functions for the serialization of a money data type in Elixir
Other
27 stars 18 forks source link

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

Closed KungPaoChicken closed 5 years ago

KungPaoChicken commented 5 years ago

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 :)

njwest commented 5 years ago

+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
kipcole9 commented 5 years ago

@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.

KungPaoChicken commented 5 years ago

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

kipcole9 commented 5 years ago

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.

kipcole9 commented 5 years ago

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