这是我模型的定义const Sequelize = require('sequelize');const sequelize = require('../../db/db_tp.js');const manage_notice = sequelize.define('manage_notice', { nid: {type:Sequelize.INTEGER,primaryKey: true,autoIncrement: true}, nname:Sequelize.STRING(20), nmaincolor:Sequelize.STRING(20), nothercolor:Sequelize.STRING(20), nshareicon:Sequelize.STRING(100), nsharetitle:Sequelize.STRING(30), nsharecontent:Sequelize.STRING(50), }) manage_notice.sync({force: false}).then(function () { // Table created manage_notice.findAll().then(result => { }) });module.exports = manage_notice;因为之前就有个有一定数据的表,但是每次映射的时候,都是因为表名重复新建了一个 尾巴加了s的表。如果是这样的话,改表结构不是很麻烦吗?一开始就要想好所有字段结构?
1 回答
一只萌萌小番薯
TA贡献1795条经验 获得超7个赞
const manage_notice = sequelize.define('manage_notice', {
...
}, {
tableName: 'manage_notice'//指定表名
})
添加回答
举报
0/150
提交
取消