You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mapping.go
    path of file: ./repos/bk-cmdb/src/scene_server/admin_server/upgrader/y3.10.202104221702
    
    the code of the file until where you have to start completion: /*
 * Tencent is pleased to support the open source community by making 蓝鲸 available.
 * Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
 * Licensed under the MIT License (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * http://opensource.org/licenses/MIT
 * Unless required by applicable law or agreed to in writing, software
    
func instanceObjectIDMapping(ctx context.Context, db dal.RDB, conf *upgrader.Config) (err error) {

	exists, err := db.HasTable(ctx, objectBaseMapping)
	if err != nil {
		blog.ErrorJSON("check table(%s) exist error, err: %s", objectBaseMapping, err)
		return err

	}
	if !exists {
		if err := db.CreateTable(ctx, objectBaseMapping); err != nil {
			blog.ErrorJSON("create table(%s) error, err: %s", objectBaseMapping, err)
			return err
		}

	}

	index := types.Index{
		Name:       common.CCLogicIndexNamePrefix + "InstID",
		Keys:       bson.D{{common.BKInstIDField, 1}},
		Background: true,
		Unique:     true,
	}
	if err := db.Table(objectBaseMapping).CreateIndex(ctx, index); err != nil && !db.IsDuplicatedError(err) {
		return err
	}

	return nil
}