创建记录时 Prisma typescript 类型错误

Prisma typescript type error when creating record

我在 MySql 中使用 prisma。 当我尝试创建新记录(学校)时,我在控制台中收到类型错误。 我也在使用一个名为 Remix.run 的框架,但这应该不是问题所在。

我也试过使用 mongoDB,但我遇到了相同类型的错误。

错误

251 console.log(info);
252 });
253 let data = {school_code: key, otp: code};
→ 254 await db.schools.create({
    data: {
        school_code: 'ISP0TMORECNJS9TB',
        ~~~~~~~~~~~
        otp: 'EMI5DU'
    }
})

Unknown arg `school_code` in data.school_code
for type schoolsCreateInput.Available args:

    type schoolsCreateInput {
        id ? : String
        v ? : Int | Null
        otp: String
    }

Prisma 架构

datasource db {
    provider = "mysql"
    url = "mysql://root@localhost:3306/myeducatio"
}

model schools {
    otp String @db.Text
    school_code String @id
}

代码

方法一

let data: any = {
    school_code: key,
    otp: code
};

await db.schools.create({
    data,
});

方法二

await db.schools.create({
    data: {
        school_code: key,
        otp: code
    }
});

发现我在项目文件夹外安装了 prisma。 我刚刚删除了它并重新安装了它。