You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using Shoulda Matchers 4.0.1 with Rails 6.0.0.rc1.
Rails allows you to create case-insensitive unique indices like this: add_index :api_tokens, "lower(token)", unique: true
In PostgreSQL, this would generate: "index_api_tokens_on_lower_token" UNIQUE, btree (lower(token::text))
In my model spec, I've tried validating: it { should have_db_index(:token).unique } it { should have_db_index("lower(token::text)").unique } it { should have_db_index("lower(token)").unique }
I get some variation of the following failure no matter what form the validation takes: Expected ApiToken to have a unique index on columns lower(token::text) ()
Is there some way to accommodate for this type of index in the existing gem functionality?
The text was updated successfully, but these errors were encountered:
There is not, but this has been reported already: #945. I don't have any bandwidth at the moment unfortunately to implement this but I would gladly take a PR!
Using Shoulda Matchers 4.0.1 with Rails 6.0.0.rc1.
Rails allows you to create case-insensitive unique indices like this:
add_index :api_tokens, "lower(token)", unique: true
In PostgreSQL, this would generate:
"index_api_tokens_on_lower_token" UNIQUE, btree (lower(token::text))
In my model spec, I've tried validating:
it { should have_db_index(:token).unique }
it { should have_db_index("lower(token::text)").unique }
it { should have_db_index("lower(token)").unique }
I get some variation of the following failure no matter what form the validation takes:
Expected ApiToken to have a unique index on columns lower(token::text) ()
Is there some way to accommodate for this type of index in the existing gem functionality?
The text was updated successfully, but these errors were encountered: