啊啊啊写了一天人快疯了
这是我的实例数据库
其中participants的内容为
{"userId":"928967225015160844","username":"itzdrli","avatar":"https://cdn.discordapp.com/avatars/928967225015160844/0d7e5b5a79393e545d76c244ef3f195f.png"}
数据库是这样定义的
declare module 'koishi' {
interface Tables {
helpdesk_list: HelpdeskList
}
}
export interface HelpdeskList {
id: number
platform: string
participants: {
username: string
userId: string
avatar: string
}
contents: {
username: string
userId: string
date: string
message: string
}
ticketStatus: string
creationDate: string
}
ctx.model.extend('helpdesk_list', {
id: 'unsigned',
platform: 'string',
participants: 'json',
contents: 'json',
ticketStatus: 'string',
creationDate: 'string',
}, {
autoInc: true,
})
请问我该如何通过ctx.datebase.create/set/upsert为participants添加第二项内容使其成为类似
0: {
"userId": "928967225015160844",
"username": "itzdrli",
"avatar": "https://cdn.discordapp.com/avatars/928967225015160844/0d7e5b5a79393e545d76c244ef3f195f.png"
}
1: {
"userId": "1145141919810",
"username": "idk",
"avatar": “xxxxxx "
}
的内容
(反正就是怎么做才能让pariticipant里存储多个用户的信息)