Skip to content
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

Merged
merged 2 commits into from
Jun 7, 2024
Merged

Conversation

vatanasov
Copy link
Contributor

No description provided.

@vatanasov vatanasov self-assigned this Jun 5, 2024
@sborrazas sborrazas changed the title feat: task for generating migrations chore: task for generating migrations Jun 6, 2024

# The :change option may be used by other tasks but not the CLI
assigns = [
# credo:disable-for-next-line
Copy link
Contributor

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

Copy link
Contributor Author

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.

defp pad(i), do: to_string(i)

embed_template(:migration, """
defmodule <%= inspect @mod %> do
Copy link
Contributor

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()}
Copy link
Contributor

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?

@vatanasov vatanasov requested a review from sborrazas June 6, 2024 11:30
@sborrazas sborrazas merged commit 4d5949e into master Jun 7, 2024
7 checks passed
@sborrazas sborrazas deleted the gen-migrations-task branch June 7, 2024 13:27
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.

None yet

3 participants