fix(ops): 修复企微报告表零日期导致无法保存
早期 INSERT 未写 updated_at,MySQL 落成 0000-00-00,Prisma 读行失败。
This commit is contained in:
@@ -34,12 +34,15 @@ async function main() {
|
||||
['monthly', '经营月报', 9],
|
||||
];
|
||||
for (const [kind, name, hour] of seeds) {
|
||||
await prisma.$executeRaw`
|
||||
INSERT IGNORE INTO wecom_report_push
|
||||
(kind, name, webhook_url, enabled, send_hour, send_minute, send_weekday, send_month_day)
|
||||
VALUES
|
||||
(${kind}, ${name}, ${PLACEHOLDER}, 0, ${hour}, 0, 1, 1)
|
||||
`;
|
||||
await prisma.$executeRawUnsafe(
|
||||
`INSERT IGNORE INTO wecom_report_push
|
||||
(kind, name, webhook_url, enabled, send_hour, send_minute, send_weekday, send_month_day, created_at, updated_at)
|
||||
VALUES (?, ?, ?, 0, ?, 0, 1, 1, CURRENT_TIMESTAMP(3), CURRENT_TIMESTAMP(3))`,
|
||||
kind,
|
||||
name,
|
||||
PLACEHOLDER,
|
||||
hour,
|
||||
);
|
||||
}
|
||||
console.log('migrate-wecom-report done');
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ model WecomReportPush {
|
||||
lastSentPeriod String? @map("last_sent_period") @db.VarChar(16)
|
||||
lastSentAt DateTime? @map("last_sent_at") @db.DateTime(3)
|
||||
createdAt DateTime @default(now()) @map("created_at") @db.DateTime(3)
|
||||
updatedAt DateTime @updatedAt @map("updated_at") @db.DateTime(3)
|
||||
updatedAt DateTime @default(now()) @updatedAt @map("updated_at") @db.DateTime(3)
|
||||
|
||||
@@map("wecom_report_push")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user