Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set all columns when creating arrays of models #595

Merged
merged 2 commits into from
Feb 17, 2024

Conversation

gwynne
Copy link
Member

@gwynne gwynne commented Feb 16, 2024

These changes are now available in 1.47.1

When performing an insert query (the "create" model action), we now explicitly emit DEFAULT as the value for fields which have not been set. This ensures that when creating an array of models, the column count for each individual model is the same even if not all fields are set on each one, avoiding a fatal error.

Fixes #594.

…aults for all fields to avoid column count mismatches in model arrays. Fixes #594
@gwynne gwynne added bug Something isn't working semver-patch Internal changes only labels Feb 16, 2024
@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3ae5187) 47.32% compared to head (1c1508f) 47.39%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #595      +/-   ##
==========================================
+ Coverage   47.32%   47.39%   +0.06%     
==========================================
  Files         106      106              
  Lines        4754     4756       +2     
==========================================
+ Hits         2250     2254       +4     
+ Misses       2504     2502       -2     
Files Coverage Δ
Sources/FluentKit/Model/Fields.swift 97.43% <100.00%> (+0.13%) ⬆️
Sources/FluentKit/Model/Model+CRUD.swift 81.50% <100.00%> (ø)

... and 2 files with indirect coverage changes

@gwynne gwynne merged commit bb47433 into main Feb 17, 2024
15 checks passed
@gwynne gwynne deleted the fix-creating-models-with-unset-optional-fields branch February 17, 2024 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semver-patch Internal changes only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fatal error "Non-uniform query input" when creating models from a collection.
5 participants