Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Sequelize 中是否有任何方法可以添加另一列,然后用另一列的内容填充它?
您可以使用迁移来做到这一点。
就像是
queryInterface.addColumn( 'MyAwesomeTable', 'myAwesomeColumn', { type: Sequelize.STRING, default: 6 } ).then(() => { return queryInterface.sequelize.query('UPDATE MyAwesomeTable SET myAwesomeColumn = someOtherColumn') })