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

Save index order :desc to schema.rb (sqlite). Fixes #30902 #30970

Merged
merged 2 commits into from Oct 25, 2017

Conversation

Projects
None yet
3 participants
@rohitpaulk
Copy link
Contributor

rohitpaulk commented Oct 24, 2017

Summary

Fixes #30902.

Although the sqlite adapter supports index sort orders, they weren't being written to db/schema.rb.

This uses index_xinfo instead of index_info (which was used previously), as the latter doesn't contain information about the sort order.

@rails-bot

This comment has been minimized.

Copy link

rails-bot commented Oct 24, 2017

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @rafaelfranca (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

Save index order :desc to schema.rb (sqlite). Fixes #30902
Although the sqlite adapter supports index sort orders, they
weren't being written to db/schema.rb.

@rohitpaulk rohitpaulk force-pushed the rohitpaulk:fix-sqlite-3-index-order-dump branch to 82ae836 Oct 24, 2017

@rohitpaulk

This comment has been minimized.

Copy link
Contributor Author

rohitpaulk commented Oct 24, 2017

There are test failures, I'm looking into them.

@rohitpaulk

This comment has been minimized.

Copy link
Contributor Author

rohitpaulk commented Oct 24, 2017

Looks like PRAGMA index_xinfo was only added in sqlite 3.8.9, and the current version on Travis is 3.8.2.

@rafaelfranca

This comment has been minimized.

Copy link
Member

rafaelfranca commented Oct 24, 2017

We can add a method to check if it is supported and conditionally use index_xinfo

@rohitpaulk rohitpaulk force-pushed the rohitpaulk:fix-sqlite-3-index-order-dump branch to ab8c7a5 Oct 25, 2017

@rohitpaulk

This comment has been minimized.

Copy link
Contributor Author

rohitpaulk commented Oct 25, 2017

I ended up extracting ordered columns from the sql query itself, like the postgres adapter does.

@rafaelfranca rafaelfranca merged commit 08df10a into rails:master Oct 25, 2017

2 checks passed

codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@rohitpaulk rohitpaulk deleted the rohitpaulk:fix-sqlite-3-index-order-dump branch Oct 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.