私はdb:seed:all
に1時間以上苦労しており、ゆっくりとこのことについて私の心を失っています。Sequelize-CLIシードャ - 定義されていないプロパティを読み取ることができません
'use strict';
module.exports = function (sequelize, DataTypes) {
var Car = sequelize.define('Cars', {
name: DataTypes.STRING,
type: DataTypes.INTEGER,
models: DataTypes.INTEGER
}, {
classMethods: {
associate: function (models) {
// associations can be defined here
}
}
});
return Car;
};
これは、移行にあり、正常に動作しますsequelize db:migrate
を使用してデータベースに行く:
次は、シードファイル(2台の車)を挿入したかったのです。今、私はsequelize db:seed:all
を実行すると、私はエラー、次の取得
'use strict';
module.exports = {
up: function (queryInterface, Sequelize) {
return queryInterface.bulkInsert(
'Cars',
[
{
name: "Auris",
type: 1,
models: 500,
createdAt: Date.now(), updatedAt: Date.now()
},
{
name: "Yaris",
type: 1,
models: 500,
createdAt: Date.now(), updatedAt: Date.now()
}
]
);
},
down: function (queryInterface, Sequelize) {
}
};
: は、だから私は、コマンドにsequelize seed:create --name insertCars
を走り、bulkInsert
を追加
Loaded configuration file "config\config.json".
Using environment "development".
== 20160510132128-insertCars: migrating =======
Seed file failed with error: Cannot read property 'name' of undefined
は、誰もがこれらのシーダーを実行している任意の経験を持っていますか?
{
"development": {
"username": "mydbdude",
"password": "mydbdude",
"database": "Cars",
"host": "127.0.0.1",
"dialect": "mssql",
"development": {
"autoMigrateOldSchema": true
}
},
....other configs
}
EDIT::DBから出力:ここにあなたの情報について は私の設定ファイルである、私はまだ私は今、その後、この作業を取得することができていないので
Sequelize [Node: 5.9.1, CLI: 2.4.0, ORM: 3.23.0]
Loaded configuration file "config\config.json".
Using environment "development".
No migrations were executed, database schema was already up to date.
こんにちは、 'sequelize db:migrate'の端末出力を表示できますか? – paolord
@paolord私の元の質問を編集し、db:migrateの出力を下に追加しました – Tikkes
あなたはどのDBの方言を使用していますか?私はPostgresと大文字と小文字を区別した名前で問題を抱えていました(つまり、 'cars'と' cars'テーブルpostgresが作成します) –