Changing a Primary Key

I have a TAureliusDataset (with an object manager and no associations) and it works well. However, because of a change in a third party system I need to change the primary key in the table. I know I should have used my own key and just used theirs as a piece of data - which I would normally do, but we are where we are.

Anyway, when I edit the table, set the new value and call post all looks fine on the linked data, but it doesn't seem to flush to the database (sqLite). I'm obviously missing a trick here. Any ideas?


You can't change the id of an existing entity using the object manager. The id is used to reference the internal in-memory cache, if you modify it, the manager can't know the previous state of the object.
You have to use SQL to update the primary key.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.