Skip to content

Conversation

@zimt28
Copy link
Contributor

@zimt28 zimt28 commented Jan 10, 2021

Use ecto_sql's formatter config when generating migrations.

I'm using File.cwd!/1 here, as suggested by José:

if the project is being compiled with Mix, "File.cwd!" will always point to the root directory because Mix always runs from root
(https://groups.google.com/g/elixir-lang-talk/c/Ls0eJDdMMW8/m/VLWWAKWPAQAJ)

@zimt28
Copy link
Contributor Author

zimt28 commented Jan 10, 2021

I'd also like to keep the resource's attribute order for the migration but haven't figured yet out how the sorting currently works :)

@zachdaniel
Copy link
Contributor

@zimt28 sorting is complicated because there are order dependent operations. So we have a bunch of fall-through cases for determining if one operation has to happen after another. So what you could do is add a case at the bottom of that for the AddAttribute, RemoveAttribute and AlterAttribute to sort them based on their position in the resource's attributes.

@zachdaniel zachdaniel merged commit 618d16d into ash-project:master Jan 10, 2021
@zachdaniel
Copy link
Contributor

More great work :)

🚀 Thank you for your contribution! 🚀

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.

2 participants