Skip to content

(fix) For renamed & modified attributes, use new attribute source in down migration #604

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

Conversation

awerment
Copy link
Contributor

@awerment awerment commented Aug 3, 2025

fix(#582) For renamed & modified attributes, use new attribute source in down migration

When an attribute is renamed, alongside other changes to it (like changing default or not null constraint), the generated up migration first renames the column, then modifies it.

For the generated down migration, the order of operations is reversed, so we need to use the new column name when modifying the column, before renaming it back.

(i) There is one test failing for me locally, that I think is unrelated to this change (it's also failing on main)

Contributor checklist

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
    • (modified existing unit test)
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

When an attribute is renamed, alongside other changes to it (like changing default or not null constraint), the generated up migration first renames the column, then modifies it.

For the generated down migration, the order of operations is reversed, so we need to use the new column name when modifying the column, before renaming it back.
@zachdaniel zachdaniel merged commit baf4e32 into ash-project:main Aug 3, 2025
60 of 62 checks passed
@zachdaniel
Copy link
Contributor

🚀 Thank you for your contribution! 🚀

zachdaniel pushed a commit that referenced this pull request Aug 9, 2025
closes: #582

When an attribute is renamed, alongside other changes to it (like changing default or not null constraint), the generated up migration first renames the column, then modifies it.

For the generated down migration, the order of operations is reversed, so we need to use the new column name when modifying the column, before renaming it back.
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