activerecord-sqlserver-adapter icon indicating copy to clipboard operation
activerecord-sqlserver-adapter copied to clipboard

Fix change_column re-adding indexes without their options (#1344)

Open b-nik opened this issue 9 months ago • 3 comments

b-nik avatar Jun 20 '25 11:06 b-nik

@b-nik Thanks for the PR. I assume it is to fix https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/1344 Could you add some tests to confirm it fixes the issue? Thanks

aidanharan avatar Jun 20 '25 14:06 aidanharan

No problem, I'll have to check how to run tests for this, and how to write appropriate tests to actually test this case (I'm not too well versed in the rails adapter internals) when I have more time, and I'll get back to you.

Btw I manually tested this on a Rails 8.0 app so hopefully this fix can be backported on 8.0 as well and not just for 8.1.

b-nik avatar Jun 20 '25 15:06 b-nik

@aidanharan Trying to run the tests I noticed that the main branch is using an activerecord version ( 8.1.0alpha ) that doesn't seem to exist? Am I missing something?

b-nik avatar Jun 22 '25 09:06 b-nik

@aidanharan Trying to run the tests I noticed that the main branch is using an activerecord version ( 8.1.0alpha ) that doesn't seem to exist? Am I missing something?

You need to run the tests against the Rails main branch. This can be done using:

RAILS_BRANCH=main bundle install
RAILS_BRANCH=main bundle exec rake test

aidanharan avatar Jun 23 '25 10:06 aidanharan

@b-nik I added a test to the PR. Could you review it please?

aidanharan avatar Jun 23 '25 11:06 aidanharan

@aidanharan Looks good - I added an extra test case with multiple indexes and index options to check they are all retained.

b-nik avatar Jun 23 '25 12:06 b-nik

@b-nik I have back-ported the fix to the 8-0-stable branch. Thanks for the PR!

aidanharan avatar Jun 23 '25 14:06 aidanharan