Repository navigation
fix(ios): save NULL when a date or number field is cleared - #3429
Merged
Merged
Conversation
The row editor wrote an emptied field as '' whatever the column type, so MySQL without strict mode stored a cleared DATETIME as the zero date. A field whose type has no empty value now saves NULL, and a NOT NULL column of such a type keeps its stored value.
A stored '' in a SQLite DATETIME column read as an edit and was saved as NULL with any other field. Only a field the user emptied is read for its type now, and a type name the rule does not know, such as PostgreSQL's USER-DEFINED for citext, keeps ''.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
On iPhone and iPad, clearing a date field and saving wrote
deleted_at = ''. MySQL without strict mode stores that as0000-00-00 00:00:00, so a cleared soft-delete still reads as deleted; strict servers refuse the save. Turning NULL off on a NULL date and saving without typing wrote''too. The row editor sent an emptied field as''whatever the column type.Change
''.''SQLite already holds in a DATETIME column stays.TableProModels, since the iOS app has no classified column type.Verified
ColumnInfoEmptyValueTestspasses underswift test. The newRowDetailViewModelTestscases compile here (build-for-testing, arm64 simulator); this Mac has no simulator runtime, so they run on CI.Not in this PR
Docs: TableProApp/docs#23