Skip to content

Commit

Permalink
Use Version module on migrate version compare
Browse files Browse the repository at this point in the history
  • Loading branch information
Neylix committed Oct 8, 2024
1 parent 9d7d4e6 commit 4062b4d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/mix/tasks/migrate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ defmodule Mix.Tasks.Archethic.Migrate do
migration_version = Regex.run(~r/.*(?=@)/, file_name) |> List.first()
{migration_version, migration_path}
end)
|> Enum.filter(fn {migration_version, _} -> last_version < migration_version end)
|> Enum.filter(fn {migration_version, _} ->
Version.compare(last_version, migration_version) == :lt
end)
|> Enum.map(fn {version, path} -> {version, Code.eval_file(path)} end)
|> Enum.filter(fn
{_version, {{:module, module, _, _}, _}} ->
Expand All @@ -80,6 +82,7 @@ defmodule Mix.Tasks.Archethic.Migrate do
false
end)
|> Enum.map(fn {version, {{_, module, _, _}, _}} -> {version, module} end)
|> Enum.sort_by(&elem(&1, 0), Version)
end

defp get_migrations_path() do
Expand Down

0 comments on commit 4062b4d

Please sign in to comment.