You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think that has anything to do with Koa... You should check the SQL generated by Sequelize to perform that database query, as that can shed some light into why your code isn't working as expected. Add logging: console.log, like this:
Code to reproduce
async findByQiniuKey(qiniu_key: string) { const result = await qiniuDataModel.findAndCountAll({ where: { qiniu_key }, }); return result; }
const model = sequelize.define<QiniuDataModel>( 'qiniu_data', { id: { type: DataTypes.INTEGER, primaryKey: true, allowNull: false, autoIncrement: true, }, user_id: { type: DataTypes.INTEGER, }, prefix: { type: DataTypes.STRING(50), }, bucket: { type: DataTypes.STRING(50), }, qiniu_key: { type: DataTypes.STRING(150), }, qiniu_hash: { type: DataTypes.STRING(50), }, qiniu_fsize: { type: DataTypes.STRING(50), }, qiniu_mimeType: { type: DataTypes.STRING(50), }, qiniu_putTime: { // 会返回:16511776862952760,超出DataTypes.INTEGER大小,可以使用DataTypes.BIGINT type: DataTypes.STRING(50), }, qiniu_type: { type: DataTypes.STRING(50), }, qiniu_status: { type: DataTypes.STRING(50), }, qiniu_md5: { type: DataTypes.STRING(50), }, }, { paranoid: true, freezeTableName: true, createdAt: 'created_at', updatedAt: 'updated_at', deletedAt: 'deleted_at', } );
cant find.....but,use where id=something,it can find
Executing (default): SELECT
id,
user_id,
prefix,
bucket,
qiniu_key,
qiniu_hash,
qiniu_fsize,
qiniu_mimeType,
qiniu_putTime,
qiniu_type,
qiniu_status,
qiniu_md5,
created_at,
updated_at,
deleted_atFROM
qiniu_dataAS
qiniu_dataWHERE (
qiniu_data.
deleted_atIS NULL AND
qiniu_data.
qiniu_key= 'homeImage/111.png'); result:{ count: 0, rows: [] }
but use sqltool,it can work!
The text was updated successfully, but these errors were encountered: