kinto
kinto copied to clipboard
Rename object id
Suggested by @n1k0
Example:
echo '{"data": {"id":"tutu"}}' | http PUT :8888/v1/buckets/test --auth user:pass
Rename object id specified in URI using the id from the body payload.
Todo:
- rename
id
column - rename
parent_id
- change permissions object URI
Thoughts ?
No strong feelings. How does this work with synchronization?
How does it works with tombstones?
From the client point of view, this would just look like as if the bucket/collection/record was deleted (eg. 404)
Ok so we recreate it with the same last_modified id, we recreate all the child objects with their ID and last_modified value, we recreate all the permissions and we add tombstones for all the recreated objects. Is that correct?
oh no, I would just do something like:
-
UPDATE records SET id=$newid WHERE id=$oldid
-
UPDATE deleted SET id=$newid WHERE id=$oldid
-
UPDATE records SET parent_id=/uri/$newid WHERE ...
-
UPDATE deleted SET parent_id=/uri/$newid WHERE ...
-
UPDATE permissions SET object_id=/uri/$newid WHERE ...
Ok then we should probably allow to rename only bucket / collections but not records because it will break the synchronization mecanism.
Ah, right. I misread this and thought it was about renaming records. Renaming buckets and collections seems OK to me.