की संपत्ति नहीं पढ़ सकते हैं मैं अब एक घंटे से अधिक के लिए db:seed:all
के साथ संघर्ष कर रहा हूं और धीरे-धीरे मैं इसके बारे में अपना मन खो रहा हूं।सीक्वेलिज़-सीएलआई सीडर - अपरिभाषित
'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 seed:create --name insertCars
भाग गया और bulkInsert
कहा: अब
'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 db:seed:all
चलाने मैं त्रुटि निम्न हो:
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
}
संपादित करें: 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 डीबी: माइग्रेट' का टर्मिनल आउटपुट दिखा सकते हैं? – paolord
@paolord मैंने अपना मूल प्रश्न संपादित किया और डीबी से आउटपुट जोड़ा: नीचे – Tikkes
पर माइग्रेट करें क्या आप डीबी बोली का उपयोग कर रहे हैं? मुझे पोस्टग्रेज़ और केस संवेदनशील नामों के साथ समस्याएं थीं (यानी 'कारों' बनाम 'कारों' तालिका पोस्टग्रेस बनाते हैं) –