[ALOY-486] sql adapter does not update ID in client-side model when using AUTOINCREMENT
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-08-06T22:00:11.000+0000 |
Affected Version/s | Alloy 1.0.0 |
Fix Version/s | Alloy 1.0.0, 2013 Sprint 02 |
Components | Runtime |
Labels | qe-manualtest |
Reporter | Tony Lukasavage |
Assignee | Tony Lukasavage |
Created | 2013-01-25T12:24:21.000+0000 |
Updated | 2014-08-06T22:00:11.000+0000 |
Description
If a new model is being created that relies on an AUTOINCREMENT id, it is not updated in the client-side model when the INSERT happens. The id doesn't update until the next collection.fetch(), and model.fetch() doesn't work because there's no id to match up to on the client-side.
To resolve this issue we should grab the last inserted id after a new model is created and assign it to the model's model.id field, if the idAttribute is not the Alloy default "alloy_id". If it's "alloy_id", then just assign a GUID.
Alloy: 1.0.1 master TiSDK: 3.1.0.v20130219190219 CLI: 3.0.24 Verified as fixed. Using the 'models/sql_no_migration', added Log info (http://pastie.org/6262111 ) Closing.