feat: added a type mismatch indicator (fixes #138) #143
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a column is defined with one type (e.g.,
INTEGER
) but stores a value of another type (e.g.,TEXT
), an indicator is displayed with a tooltip showing the mismatched type. This is very useful since SQLite has flexible typing, which can cause issues when the data is handled in an environment where this behavior is not expected.Important information:
I had to modify a series of files to make this work properly, but I tried to do it in the best way possible. However, the
convertSqliteType()
function in thesql-helper.ts
file made me the most "uncomfortable," since it's used in many places.I had to make this change because there are cases where the type is not explicitly defined for SQLite, such as when accessing the default
sqlite_sequence
table. It definesname
andseq
, but their types are""
(literally empty), and currently, the code was forcing them to be interpreted asTEXT
, which seems incorrect. For example,seq
is sent as an integer, so it should be treated asINTEGER
.This was done to ensure that the mismatch comparison system stops considering this field for analysis, as the column type is natively undefined.