Prisma 2 无法获取具有空值的 DateTime 列

问题描述

      await this.prisma.fee_collections.findMany({
        where: whereClauseWithTransactionDateCondition,include: {
            student_master: {
                select: {
                    fee_start_month: true,}
            }
        }
    });

在我的数据库中,fee_start_month 列架构:

fee_start_month 日期时间? @db.Date

在fee_start_month 列中,有些值为空,因此prisma2 无法获取这些记录,并引发异常。

产生的错误: [巢] 21275 - 15/03/2021,13:09:21 [ExceptionsHandler] 无效的 prisma.fee_collections.findMany() 调用

值超出类型范围。 fee_start_month 列包含无效的 DateTime 值,其中日或月设置为零。 +3337 毫秒

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)