ash_postgres icon indicating copy to clipboard operation
ash_postgres copied to clipboard

Unneeded Change Added to Migration

Open JEG2 opened this issue 5 months ago • 0 comments

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

AI Policy

  • [x] I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.

Versions

Erlang: 28.0.2 Elixir: 1.18.4-otp-28 Ash: 3.5.37 AshPostgreSQL: 2.6.17

Operating system

macOS Sequoia 15.6.1

Current Behavior

While reading Chapter 2 of the Ash Framework book, I noticed that ash.codegen generated a slightly more verbose migration than was strictly needed:

https://github.com/JEG2/tunez/commit/e19a90596efe3e9c605bba0c6f66531138002192#diff-38665c31e93a41d7132c1bff9af04ecb4c757bfd15758d22a5839e64d6d24752

It looks like it is removing a foreign key only to reset it to the same value.

Rebecca Le asked me to open this issue.

Reproduction

This is the code I added before invoking the generator:

https://github.com/JEG2/tunez/commit/e19a90596efe3e9c605bba0c6f66531138002192#diff-11818765a97af826d1ca632b019da6be529cbdd9af6f4d2c2231405dec15dccbR64-R67

Expected Behavior

I think it would be enough just to create and drop the index for this change.

JEG2 avatar Sep 04 '25 16:09 JEG2