Sequelize Seeder 问题
2019-10-22
545
我正在使用带有 postgres 的 Sequelize,这是我第一次使用种子。我刚刚迁移了数据,并已设置了数据库以接收数据。我能够通过表单发布通过前端上传数据。但由于某种原因,我的种子一直失败。我收到的唯一错误是“错误:意外标识符”。
我检查了很多次,并让其他人检查以确保我的表和列拼写正确。我对语法做了同样的事情。
我的种子。(是的,我的表名是小写和复数。起诉我。)
'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
1个回答
尝试重命名
101341932
Dattatraya Kale
2019-10-22