Files
mv2_simple_crx/server/models/amazon_search_item.js
张成 aecb7944a8 1
2026-03-18 18:07:41 +08:00

31 lines
1.3 KiB
JavaScript

import { DataTypes } from 'sequelize';
export function define_amazon_search_item(sequelize) {
return sequelize.define(
'amazon_search_item',
{
id: { type: DataTypes.BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true },
asin: { type: DataTypes.STRING(32), allowNull: false },
url: { type: DataTypes.STRING(2048), allowNull: false },
title: { type: DataTypes.STRING(1024), allowNull: true },
price: { type: DataTypes.STRING(64), allowNull: true },
rating: { type: DataTypes.FLOAT, allowNull: true },
rating_text: { type: DataTypes.STRING(64), allowNull: true },
review_count: { type: DataTypes.INTEGER, allowNull: true },
review_count_text: { type: DataTypes.STRING(64), allowNull: true },
rank_index: { type: DataTypes.INTEGER, allowNull: true, comment: '列表中的 index 字段' },
batch_key: { type: DataTypes.STRING(64), allowNull: false, comment: '一次列表抓取的批次 key' },
batch_total: { type: DataTypes.INTEGER, allowNull: true },
batch_limit: { type: DataTypes.INTEGER, allowNull: true }
},
{
tableName: 'amazon_search_item',
indexes: [
{ fields: ['asin'] },
{ fields: ['batch_key'] },
{ fields: ['created_at'] }
]
}
);
}