gpt4 book ai didi

javascript - Sequelize 播种机问题

转载 作者:行者123 更新时间:2023-12-02 22:43:27 24 4
gpt4 key购买 nike

我正在将 Sequelize 与 postgres 一起使用,这是我第一次使用播种器。我刚刚迁移了数据,并且已经设置了数据库来接收数据。我可以通过表单帖子通过我的前端上传数据。但出于某种原因,我的播种机总是失败。我收到的唯一错误是“错误:意外的标识符”。

我已经检查过多次,并让其他人检查以确保我的表格和列拼写正确。我对语法也做了同样的事情。

我的播种者。 (是的,我的表名是小写和复数。告我吧。)

'use strict';

module.exports = {
up: (queryInterface, Sequelize) => {
return queryInterface.bulkInsert(
"potatoes",
[
{name: "Yukon Gold", starch_level: "All Purpose", cook_method: "boil, bake, fry", createdAt: New Date(), updatedAt: New Date()},
{name: "Purple Peruvian", starch_level: "All Purpose", cook_method: "boil, bake, fry, roast, grill", createdAt: New Date(), updatedAt: New Date()},
{name: "Idaho Russet", starch_level: "Starchy", cook_method: "bake, mash, fry", createdAt: New Date(), updatedAt: New Date()},
{name: "Katahdin", starch_level: "Starchy", cook_method: "boil, bake, fry", createdAt: New Date(), updatedAt: New Date()},
{name: "Red Bliss", starch_level: "Waxy", cook_method: "soup, stew, boil, roast, salad, casserole", createdAt: New Date(), updatedAt: New Date()},
{name: "New Potato", starch_level: "Waxy", cook_method: "boil, steam, roast", createdAt: New Date(), updatedAt: New Date()},
{name: "Adirondack Blue", starch_level: "Waxy", cook_method: "mash, bake, boil, steam, salad, casserole, gratin", createdAt: New Date(), updatedAt: New Date()},
{name: "Adirondack Red", starch_level: "Waxy", cook_method: "boil, mash, fry", createdAt: New Date(), updatedAt: New Date()},
{name: "Fingerling", starch_level: "Waxy", cook_method: "boil, bake, roast, salad", createdAt: New Date(), updatedAt: New Date()},
{name: "Carola", starch_level: "Waxy", cook_method: "grill, roast, boil, fry, salad, casserole, gratin", createdAt: New Date(), updatedAt: New Date()},
{name: "Inca Gold", starch_level: "Waxy", cook_method: "roast, mash, boil, salad, casserole, gratin", createdAt: New Date(), updatedAt: New Date()},
{name: "Rose Gold", starch_level: "Waxy", cook_method: "bake, steam, boil, salad, casserole, gratin", createdAt: New Date(), updatedAt: New Date()},
{name: "Purple Viking", starch_level: "Waxy", cook_method: "bake, roast, boil, salad, casserole, gratin", createdAt: New Date(), updatedAt: New Date()}
],
{}
);
},
down: (queryInterface, Sequelize) => {
return queryInterface.bulkDelete("potatoes", null, {})
}
};

终端命令。

sequelize db:seed:all

我也尝试过 --seed file_name,但没有成功。

每次都会出现错误消息。

ERROR: unexpected identifier

最佳答案

尝试重命名

New Date() to new Date()

关于javascript - Sequelize 播种机问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58509585/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com