Data sync record key update #44
Labels
No labels
bug
confirmed
critical
discussion
documentation
Doing
enhancement
suggestion
support
To Do
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: hazaar/hazaar-dbi#44
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Right now we have two methods for detecting existing rows in a table.
Methods
Primary key
If the primary key is defined in the data sync record, this is used to identify an existing row. If the key exists, then an update is performed using the data in the data sync record. If they key does not exist, then a new row is inserted with the data sync record.
Record data
If the primary key is NOT defined in the data sync record then the entire record is used to identify an existing row. This can be used to ensure that the data sync record exists in the database table as it is defined in the data sync file.
Caveats
For primary key, if the key is defined in multiple records then there is a chance that data will be overwritten each time a sync is performed. For record data, because the entire record is used, it is possible that an entirely new record will be recreated if even a single field changes in the data sync file.
Solution
Data key specifiers. In the data sync table object we can add a new attribute called keys that will define the keys to be used to identify existing rows. This will default to the primary key if this attribute does not exist. The attribute can be defined as an array of column names used to find existing rows. This will work almost exactly as the other methods but will allow a record with say, 2 columns matching to be considered the existing row.
mentioned in issue #45
created merge request !18 to address this issue
mentioned in merge request !18
closed via merge request !18
mentioned in commit
75c6f29078
mentioned in issue #47