Closed
Description
Crud/ddl/migrations is a way to go for our customers. But project after a project I observe the following clutches:
local function get_object_by_pk(part1, part2)
local bucket_id = vshard.router.bucket_id_mpcrc32(part2)
local settings, err_settings = crud.get('object', {part1, part2}, {bucket_id = bucket_id})
if err_settings ~= nil then return nil, err_settings end
return settings
end
local function upsert_object(object)
local id = settings["id"]
local bucket_id = vshard.router.bucket_id_mpcrc32(id)
local res, err = crud.replace_object("settings_object", settings, {bucket_id = bucket_id})
if err ~= nil then return nil, err end
end
But this info is already present in ddl! (ddl.register_sharding_key('object', {"id"})
)
This shoould work out-of-the-box