How to guarantee unique records?
This proxy has brilliantly solved a lot of the problems I was having. Thank you.
I'm stuck, though, on one particular table, where I need to ensure that records are unique, and don't know how. This is my model:
Code:
Ext.define('LRS.model.Answers', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'id', type:'int'},
{name:'distribution_respondent_id',type:'int'},
{name:'survey_id', type:'int'},
{name:'question_id',type:'int'},
{name:'question_response_value', type:'string'},
{name:'response_skipped', type:'int'},
{name:'response_skipreason', type:'string'},
{name:'response_comment',type:'string'},
{name:'date', type: 'long'},
{name:'synced', type:'string'}
]
},
identifier: 'uuid'
});
Ideally, I would like to have a composite primary key on the fields 'survey_id' and 'question_id', as that would guarantee each row's uniqueness, but I haven't been able to find out how to create a composite key in a model. Having 'id' as unique would clearly guarantee that each row is unique, by virtue of the uniqueness of 'id', but doesn't stop repeated combinations of 'survey_id' and 'question_id'. Does anybody have any ideas?