mysql命令行交互時的命令記得加分號
orm使用sequelize。
// 表的每條記錄對應(yīng)的對象schema
var Project = sequelize.define('table_project', {
id: {type : Sequelize.INTEGER, autoIncrement : true, primaryKey : true, unique : true},
project_id: { type: Sequelize.STRING, comment: '項目的id'},
online_url: { type: Sequelize.STRING, comment: '項目的線上接口地址'},
offline_url: { type: Sequelize.STRING, comment: '項目的測試接口地址'},
params: { type: Sequelize.TEXT('long') , comment: '接口json描述'},
extra: { type: Sequelize.TEXT('long') , comment: '預(yù)留的額外配置', allowNull: true}
});
Project.sync().then(function(){
console.log(arguments);
doDbAction();
}, function (err) {
console.log('err', arguments)
});
多條件或關(guān)系模糊查找
Project.findAll({
where: {
$or: [{
project_name: {
$like: '%' + text + '%'
}
}, {
user_id: {
$like: '%' + text + '%'
}
}]
},
order: [['updatedAt', 'DESC']]
})