Newbie question here.
According to https://github.com/balderdashy/waterline#indexing you cannot use a 'string' datatype as an index in Waterline due to issues with case insensitivity:
There is currently an issue with adding indexes to string fields. Because Waterline performs its queries in a case insensitive manner, we are unable to use the index on a string attribute. There are some workarounds being discussed but nothing is implemented so far. This will be updated in the near future to fully support indexes on strings.
The problems I'm concerned with are: performance; associations using 'string' keys aren't possible.
My questions are:
- Does it in fact index on strings if told to do so? If so, then what is the index based on: a) the original string as is; b) lowercase of the string; c) UPPERCASE of the string?
- If it doesn't index on strings at all, as is implied if you can assume that 'cannot use' means 'does not create', then does that mean that Waterline / database backend does a non-indexed record-by-record retrieve and compare? Seems highly inefficient, if so.
- Are 'string' and 'text' datatypes both affected or can I use 'text', in which case, question #2 needs to answered for 'text' datatypes, too.
- If you really can't use 'string', what should I use instead for foreign keys? An integer ID and a join table to bind another table with the string values? (Seems wasteful but workable for something like a keywords list).
- If, and when, will this 'issue' be fixed?
- What and/or where are the 'workarounds being discussed'?
- Is there a better ORM I should look at or just use native SQL methods (FYI, I'm using PostgreSQL).
My hoped for answer here is: 'string' can be indexed but queries against 'string' datatypes are performed using lowercase (or uppercase, but let me know which). As such, I can have a 'string' key so long as the case is correct.
Also, I assume 'string' and 'text' are effectively synonymous in Waterline, at least outside of the database's native context.
Thanks in advance for any help here.