kinto icon indicating copy to clipboard operation
kinto copied to clipboard

Rename object id

Open leplatrem opened this issue 8 years ago • 7 comments

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 ?

leplatrem avatar Nov 08 '16 11:11 leplatrem

No strong feelings. How does this work with synchronization?

glasserc avatar Nov 08 '16 19:11 glasserc

How does it works with tombstones?

Natim avatar Nov 08 '16 19:11 Natim

From the client point of view, this would just look like as if the bucket/collection/record was deleted (eg. 404)

leplatrem avatar Nov 08 '16 20:11 leplatrem

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?

Natim avatar Nov 09 '16 08:11 Natim

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 ...

leplatrem avatar Nov 09 '16 09:11 leplatrem

Ok then we should probably allow to rename only bucket / collections but not records because it will break the synchronization mecanism.

Natim avatar Nov 09 '16 10:11 Natim

Ah, right. I misread this and thought it was about renaming records. Renaming buckets and collections seems OK to me.

glasserc avatar Nov 09 '16 21:11 glasserc