38 lines
1.7 KiB
JavaScript
38 lines
1.7 KiB
JavaScript
import { DataTypes } from 'sequelize';
|
||
|
||
export function define_amazon_product(sequelize) {
|
||
return sequelize.define(
|
||
'amazon_product',
|
||
{
|
||
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 },
|
||
sku_json: { type: DataTypes.JSON, allowNull: true, comment: 'sku 结构化 JSON,如 {color:[], size:[]}' },
|
||
brand_line: { type: DataTypes.STRING(512), allowNull: true },
|
||
brand_store_url: { type: DataTypes.STRING(2048), allowNull: true },
|
||
ac_badge: { type: DataTypes.STRING(128), allowNull: true },
|
||
bestseller_hint: { type: DataTypes.STRING(512), allowNull: true },
|
||
delivery_hint: { type: DataTypes.STRING(512), allowNull: true },
|
||
social_proof: { type: DataTypes.STRING(256), allowNull: true },
|
||
sustainability_hint: { type: DataTypes.STRING(256), allowNull: true },
|
||
rating_stars: { type: DataTypes.STRING(64), allowNull: true },
|
||
review_count_text: { type: DataTypes.STRING(64), allowNull: true },
|
||
main_image: { type: DataTypes.STRING(2048), allowNull: true },
|
||
images_json: { type: DataTypes.JSON, allowNull: true },
|
||
bullets_json: { type: DataTypes.JSON, allowNull: true },
|
||
product_info_json: { type: DataTypes.JSON, allowNull: true },
|
||
detail_extra_lines_json: { type: DataTypes.JSON, allowNull: true }
|
||
},
|
||
{
|
||
tableName: 'amazon_product',
|
||
indexes: [
|
||
{ unique: true, fields: ['asin'] },
|
||
{ fields: ['created_at'] },
|
||
{ fields: ['updated_at'] }
|
||
]
|
||
}
|
||
);
|
||
}
|