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

Sequential updates not used when multi-column index is present #360

Closed
janklimo opened this issue Sep 16, 2019 · 7 comments
Closed

Sequential updates not used when multi-column index is present #360

janklimo opened this issue Sep 16, 2019 · 7 comments

Comments

@janklimo
Copy link

janklimo commented Sep 16, 2019

Given the following index (Postgres):

add_index :properties_images, [:property_id, :position], unique: true

sequential updates will not be used (and reordering always fail) unless explicitly specified:

acts_as_list scope: :property, sequential_updates: true

One way to fix this would be to scan all indexes of the target table in SequentialUpdatesMethodDefiner and see if any of them include position. Another way is just to mention this in the docs. Opening a conversation first.

@brendon
Copy link
Owner

brendon commented Sep 16, 2019

Hi @janklimo, I've been in this position before, trying to sniff the default value of a column. It's actually more fraught than you'd expect as when a rails app boots, it's not necessarily connected to the DB yet and nor should it be (in some cases). :)

I think the best bet would just to document the feature :D I didn't realise it snuck through undocumented! Would you be interested in doing up a PR for this? :)

@janklimo
Copy link
Author

Thanks for a fast response @brendon I share your sentiment on this. I think we can:

a) Try to make the gem smarter, add complexity, possibly introduce bugs (you're right, been there too 😄)
b) Document the feature with the same outcome - use sequential update correctly

The latter is a clear winner for me, I'll look into it and open a PR.

@brendon
Copy link
Owner

brendon commented Sep 16, 2019

Thanks @janklimo :) That's very much appreciated.

@brendon
Copy link
Owner

brendon commented Apr 23, 2020

Hi @janklimo, I can't remember, did you ever put forward a documentation update? :)

@iainbeeston
Copy link

Did this ever get fixed? I'm seeing the same issue now 😞

@brendon
Copy link
Owner

brendon commented Nov 10, 2022

As far as I know it wasn’t.

@brendon
Copy link
Owner

brendon commented Jun 4, 2024

Closing due to inactivity.

@brendon brendon closed this as completed Jun 4, 2024
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

No branches or pull requests

3 participants