You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The fields() method should always return the same Fields no matter the context (ie. database fetch or class). The TableSet::table_data function should not load the primary key as a Field but instead only set the id_ variable of the Table. Of course I say this without fully understanding the impact, but hopefully you agree with keeping everything deterministic.
The text was updated successfully, but these errors were encountered:
I think we can adopt the proposed solution in the first instance, and open an issue for the better solution.
I'm writing a (failing) test for the proposal.
Reference:
required.fields()
andexisting.fields()
will always be different because of the automatic primary key assignment. Using the example table below:required.fields()
will contain: [code, title]existing.fields()
will contain: [id, code, title]Thus, the set difference
required.fields() - existing.fields()
will always return the primary keyid
and try to drop it.Proposed solution:
Better solution:
The
fields()
method should always return the sameFields
no matter the context (ie. database fetch or class). TheTableSet::table_data
function should not load the primary key as aField
but instead only set theid_
variable of theTable
. Of course I say this without fully understanding the impact, but hopefully you agree with keeping everything deterministic.The text was updated successfully, but these errors were encountered: