Skip to content

fix(ios): save NULL when a date or number field is cleared - #3429

Merged
datlechin merged 4 commits into
mainfrom
fix/ios-clear-null
Oct 15, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/ios-clear-null

Conversation

@datlechin

@datlechin datlechin commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Why

On iPhone and iPad, clearing a date field and saving wrote deleted_at = ''. MySQL without strict mode stores that as 0000-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

  • An emptied date, number, boolean, JSON or UUID field saves NULL. Text, binary, SET and unrecognized types keep ''.
  • In a NOT NULL column of those types the field keeps its stored value and Save writes nothing for it.
  • Only a field the user emptied is read this way, so a '' SQLite already holds in a DATETIME column stays.
  • The rule reads the declared type name, in TableProModels, since the iOS app has no classified column type.

Verified

ColumnInfoEmptyValueTests passes under swift test. The new RowDetailViewModelTests cases 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

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 ''.
@datlechin
datlechin merged commit 1323251 into main Oct 15, 2026
7 checks passed
@datlechin
datlechin deleted the fix/ios-clear-null branch October 15, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant