2016-05-10 3 views
1

PostgresにMySQL上で正常に動作するプロジェクトでデータベースを変更しようとしています。
移行を実行しているとき(syncとsequelize db:migrateの両方)、次のエラーが表示されます。PostgresとSequelize - 未定義のプロパティ 'name'を読み取ることができません

/myProject/node_modules/pg/lib/connection.js:109 
     self.emit(msg.name, msg); 
       ^

TypeError: Cannot read property 'name' of undefined 
    at Socket.<anonymous> (/myProject/node_modules/pg/lib/connection.js:109:20) 
    at emitOne (events.js:96:13) 
    at Socket.emit (events.js:188:7) 
    at readableAddChunk (_stream_readable.js:172:18) 
    at Socket.Readable.push (_stream_readable.js:130:10) 
    at TCP.onread (net.js:542:20) 

私はこれだけの単純なモデルを単離したが、私はまだ問題がある可能性がどのような

module.exports = (sequelize, DataTypes) => { 
    var User = sequelize.define('User', { 
    email: { 
     type: DataTypes.STRING, 
     validate: { 
     isEmail: true 
     } 
    }, 
    googleId: { 
     type: DataTypes.STRING, 
     allowNull: false 
    } 
    }, { 
    underscored: true 
    }) 

    return User 
} 

エラーが出ますか?

+0

あなたのモデルには疑問があります。続行の初期化コードを貼り付けることはできますか? – drinchev

答えて

1

これに接続文字列を変更する必要がありました。ありがとう。

var sequelize = new Sequelize(match[5], match[1], match[2], { 
    dialect: 'postgres', 
    protocol: 'postgres', 
    port: match[4], 
    host: match[3], 
    logging: false, 
    dialectOptions: { 
    ssl: true 
    } 
}) 
関連する問題