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

Add support of citext to MissingUniqueIndexChecker #147

Closed
wants to merge 1 commit into from

Conversation

djezzzl
Copy link
Owner

@djezzzl djezzzl commented Nov 16, 2022

No description provided.

@djezzzl djezzzl added the enhancement New feature or request label Nov 16, 2022
@djezzzl djezzzl self-assigned this Nov 16, 2022
@djezzzl djezzzl mentioned this pull request Nov 16, 2022
@djezzzl djezzzl closed this Nov 16, 2022
@pirj
Copy link
Contributor

pirj commented Nov 30, 2022

Does it make sense to revive this PR now?

@djezzzl
Copy link
Owner Author

djezzzl commented Dec 1, 2022

@pirj, we can revive it, although, we should distinguish cases where your fix was applied from the rest. Could you please help how we can do that?

@pirj
Copy link
Contributor

pirj commented Dec 1, 2022

I'd say two things would affect the checker's decision:

  1. Rails version. Depending on if the fix will be backported or not. Older versions would add LOWER() to queries. Newer won't.
  2. presence of LOWER() on the uniqueness index.

So, the inspector should log an error:
a) for older Rails versions when there's no LOWER() on the index
b) for newer Rails versions when there's LOWER() functional specification on the index

Does this make sense, or am I missing something?

@djezzzl
Copy link
Owner Author

djezzzl commented Dec 1, 2022

It makes total sense to me. Do we have a better way of relying on instead of the Rails version?

@djezzzl
Copy link
Owner Author

djezzzl commented Dec 1, 2022

I'm not sure we can simply say the version is greater/lower.

@pirj
Copy link
Contributor

pirj commented Dec 1, 2022

We depend on Active Record in runtime, so we can reasonably compare it:

> ActiveRecord.version > Gem::Version.new('6.0.4')
=> true
> ActiveRecord.version > Gem::Version.new('6.0.6')
=> false

Let's see when the fix is released to build a uses_lower_in_uniqueness_validation_queries? helper method correctly.

@djezzzl
Copy link
Owner Author

djezzzl commented Dec 1, 2022

Sounds like a plan to me.

@djezzzl djezzzl deleted the add-citext-support branch December 3, 2022 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants