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: migrate.go
    path of file: ./repos/bk-cmdb/src/scene_server/admin_server/service
    
    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 distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing permissions and
 * limitations under the License.
 */

package service

import (
	"encoding/json"
    
func (s *Service) createWatchToken(key event.Key) error {
	filter := map[string]interface{}{
		"_id": key.Collection(),
	}

	count, err := s.watchDB.Table(common.BKTableNameWatchToken).Find(filter).Count(s.ctx)
	if err != nil {
		blog.Errorf("check if last watch token exists failed, err: %v, filter: %+v", err, filter)
		return err
	}

	if count > 0 {
		return nil
	}

	if key.Collection() == event.HostIdentityKey.Collection() {
		// host identity's watch token is different with other identity.
		// only set coll is ok, the other fields is useless
		data := mapstr.MapStr{
			"_id":                              key.Collection(),
			common.BKTableNameBaseHost:         watch.LastChainNodeData{Coll: common.BKTableNameBaseHost},
			common.BKTableNameModuleHostConfig: watch.LastChainNodeData{Coll: common.BKTableNameModuleHostConfig},
			common.BKTableNameBaseProcess:      watch.LastChainNodeData{Coll: common.BKTableNameBaseProcess},
		}
		if err = s.watchDB.Table(common.BKTableNameWatchToken).Insert(s.ctx, data); err != nil {
			blog.Errorf("init last watch token failed, err: %v, data: %+v", err, data)
			return err
		}
		return nil
	}

	if key.Collection() == event.BizSetRelationKey.Collection() {
		// biz set relation's watch token is generated in the same way with the host identity's watch token
		data := mapstr.MapStr{
			"_id":                        key.Collection(),
			common.BKTableNameBaseApp:    watch.LastChainNodeData{Coll: common.BKTableNameBaseApp},
			common.BKTableNameBaseBizSet: watch.LastChainNodeData{Coll: common.BKTableNameBaseBizSet},
			common.BKFieldID:             0,
			common.BKTokenField:          "",
		}
		if err = s.watchDB.Table(common.BKTableNameWatchToken).Insert(s.ctx, data); err != nil {
			blog.Errorf("init last biz set relation watch token failed, err: %v, data: %+v", err, data)
			return err
		}
		return nil
	}

	data := watch.LastChainNodeData{
		Coll:  key.Collection(),
		Token: "",
		StartAtTime: streamtypes.TimeStamp{
			Sec:  uint32(time.Now().Unix()),
			Nano: 0,
		},
	}
	if err = s.watchDB.Table(common.BKTableNameWatchToken).Insert(s.ctx, data); err != nil {
		blog.Errorf("init last watch token failed, err: %v, data: %+v", err, data)
		return err
	}
	return nil
}