-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: task for generating migrations #1800
Conversation
lib/mix/tasks/gen.migration.ex
Outdated
|
||
# The :change option may be used by other tasks but not the CLI | ||
assigns = [ | ||
# credo:disable-for-next-line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid skipping credo errors. We're using them for a reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use safe_concat
here (as it suggests) it fails, because the atom is not yet created. The warning is specifically against dynamically creating atoms - but this is exactly what is wanted here.
lib/mix/tasks/gen.migration.ex
Outdated
defp pad(i), do: to_string(i) | ||
|
||
embed_template(:migration, """ | ||
defmodule <%= inspect @mod %> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do AeMdw.Migration.<%= camelized_name %>
here to avoid using macro functions
|
||
embed_template(:migration, """ | ||
defmodule <%= inspect @mod %> do | ||
@spec run(State.t(), boolean()) :: {:ok, non_neg_integer()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the State alias `alias AeMdw.Db.State?
No description provided.