# 商品管理板块表:
goods_class[商品分类表]、skus[商品规格表]、goods[商品表] 说明
# 一、goods_class[商品分类表] 字段设计
| 字段名 | 数据类型及描述 | 空 | 默认值 | 字段含义 |
|---|---|---|---|---|
| id | int(20) 主键、自增长、UNSIGNED无符号 | 否 | 主键id | |
| pid | int(20) | 否 | 0 | 上一级(父级)id |
| name | varchar(30) | 否 | 商品分类名称 | |
| desc | varchar(255) | 是 | 商品分类描述,对商品分类的简单介绍 | |
| order | int(11) | 是 | 50 | 排序,默认50 |
| status | int(1) | 否 | 1 | 可用状态:0禁用1启用 |
| create_time | datetime | 否 | CURRENT_TIMESTAMP | 数据创建时间 |
| update_time | datetime | 否 | CURRENT_TIMESTAMP | 数据更新时间 |
额外说明:
mysql每行最大只能存65535个字节。假设是utf-8编码,每个字符占3个字节。varchar存储最大字符数为(65535-2-1)/3=21844字符长度
# 二、创建[商品分类表] goods_class
# 1、技术栈php(thinkphp)同学
直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。# [商品分类表]
goods_class相关【文档】和【接口】
# 2、技术栈node(egg.js)同学
# [商品分类表]
goods_class相关【文档】和【接口】
- 直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。- 通过迁移命名创建
goods_class表:
- 创建迁移文件 命令:
npx sequelize migration:generate --name=goods_class
- 创建迁移文件
goods_class.js,内容如下:'use strict'; /** @type {import('sequelize-cli').Migration} */ module.exports = { async up (queryInterface, Sequelize) { const { INTEGER, STRING, DATE, ENUM, TEXT, BIGINT} = Sequelize; // 创建表 --- 类似我们sql语句定义表结构 await queryInterface.createTable('goods_class', { id: { type: INTEGER(20).UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键id' }, pid: { type: INTEGER(20).UNSIGNED, allowNull: false, defaultValue: 0, comment: '上一级(父级)id', }, name: { type: STRING(30), allowNull: false, defaultValue: '', comment: '商品分类名称' }, desc: { type: STRING(255), allowNull: true, defaultValue: '' , comment: '商品分类描述,对商品分类的简单介绍' }, order: { type: INTEGER,//不限定长度.默认int(11) allowNull: true, defaultValue: 50, comment: '排序,默认50' }, status:{ type: INTEGER(1), allowNull: false, defaultValue:1, comment: '状态:1:启用,0:禁用' }, // sex: { type: ENUM, values: ['男','女','保密'], allowNull: true, defaultValue: '保密', comment: '留言用户性别'}, create_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')}, update_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')} }); }, async down (queryInterface, Sequelize) { await queryInterface.dropTable('goods_class') } };
- 执行迁移文件命令生成数据库表:
// 创建数据库 npx sequelize db:migrate // 如果有问题需要回滚,可以通过 `db:migrate:undo` 回退一个变更 npx sequelize db:migrate:undo // 可以通过 `db:migrate:undo:all` 回退到初始状态 npx sequelize db:migrate:undo:all
# 三、skus[商品规格表] 字段设计
| 字段名 | 数据类型及描述 | 空 | 默认值 | 字段含义 |
|---|---|---|---|---|
| id | int(20) 主键、自增长、UNSIGNED无符号 | 否 | 主键id | |
| type | int(11) | 是 | 0 | 规格类型:0无限制,1颜色,2图片,3尺寸等等 |
| name | varchar(30) | 否 | 规格名称 | |
| default | varchar(2000) | 是 | 规格值,用逗号隔开 | |
| order | int(11) | 是 | 50 | 排序,默认50 |
| status | int(1) | 否 | 1 | 可用状态:0禁用1启用 |
| create_time | datetime | 否 | CURRENT_TIMESTAMP | 数据创建时间 |
| update_time | datetime | 否 | CURRENT_TIMESTAMP | 数据更新时间 |
额外说明:
mysql每行最大只能存65535个字节。假设是utf-8编码,每个字符占3个字节。varchar存储最大字符数为(65535-2-1)/3=21844字符长度
# 四、创建[商品规格表] skus
# 1、技术栈php(thinkphp)同学
直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。# [商品规格表]
skus相关【文档】和【接口】
# 2、技术栈node(egg.js)同学
# [商品规格表]
skus相关【文档】和【接口】
- 直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。- 通过迁移命名创建
skus表:
- 创建迁移文件 命令:
npx sequelize migration:generate --name=skus
- 创建迁移文件
skus.js,内容如下:'use strict'; /** @type {import('sequelize-cli').Migration} */ module.exports = { async up (queryInterface, Sequelize) { const { INTEGER, STRING, DATE, ENUM, TEXT, BIGINT} = Sequelize; // 创建表 --- 类似我们sql语句定义表结构 await queryInterface.createTable('skus', { id: { type: INTEGER(20).UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键id' }, type: { type: INTEGER(11), allowNull: true, defaultValue: 0, comment: '规格类型:0无限制,1颜色,2图片,3尺寸等等', }, name: { type: STRING(30), allowNull: false, defaultValue: '', comment: '规格名称' }, default: { type: STRING(2000), allowNull: true, defaultValue: '' , comment: '规格值,用逗号隔开' }, order: { type: INTEGER,//不限定长度.默认int(11) allowNull: true, defaultValue: 50, comment: '排序,默认50' }, status:{ type: INTEGER(1), allowNull: false, defaultValue:1, comment: '状态:1:启用,0:禁用' }, // sex: { type: ENUM, values: ['男','女','保密'], allowNull: true, defaultValue: '保密', comment: '留言用户性别'}, create_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')}, update_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')} }); }, async down (queryInterface, Sequelize) { await queryInterface.dropTable('skus') } };
- 执行迁移文件命令生成数据库表:
// 创建数据库 npx sequelize db:migrate // 如果有问题需要回滚,可以通过 `db:migrate:undo` 回退一个变更 npx sequelize db:migrate:undo // 可以通过 `db:migrate:undo:all` 回退到初始状态 npx sequelize db:migrate:undo:all
# 五、商品相关表字段设计
由于和商品相关联的表很多,我们这里先说明几张表,后期根据需求在补充。
# 1. 商品表goods字段设计
| 字段名 | 数据类型及描述 | 空 | 默认值 | 字段含义 |
|---|---|---|---|---|
| id | int(20) 主键、自增长、UNSIGNED无符号 | 否 | 主键id | |
| goods_class_id | int(20) | 否 | 商品分类goods_class表的id | |
| name | varchar(255) | 否 | 商品名称 | |
| desc | varchar(2000) | 是 | 商品描述 | |
| content | text | 是 | 商品详情 | |
| cover | varchar(1000) | 是 | 商品封面图代表(更多图片关联至goods_banner表) | |
| ... | ||||
| rating | float | 是 | 5.0 | 商品评分 |
| sale_count | int(11) | 是 | 0 | 总销量 |
| review_count | int(11) | 是 | 0 | 商品评论数量 |
| love_count | int(11) | 是 | 0 | 商品收藏量 |
| recommend_count | int(11) | 是 | 0 | 商品推荐量 |
| ... | ||||
| min_price | decimal(10,2) | 是 | 起售价(最低售价,多少元起) | |
| history_min_price | decimal(10,2) | 是 | 历史最低价 | |
| coupon_price | decimal(10,2) | 是 | 券后价 | |
| discount_price | decimal(10,2) | 是 | 折后价 | |
| spike_price | decimal(10,2) | 是 | 秒杀价 | |
| other_price | decimal(10,2) | 是 | 其它设置价(如:首件价,新客价,30天低价等等) | |
| ... | ||||
| unit | varchar(10) | 是 | 件 | 单位(默认:件) |
| stock | int(11) | 是 | 0 | 库存 |
| min_stock | int(11) | 是 | 0 | 库存预警 |
| stock_display | int(1) | 是 | 0 | 库存显示:0隐藏、1显示 |
| ischeck | int(1) | 是 | 0 | 审核状态:0审核中、1通过、2拒绝(不通过) |
| goods_status | int(1) | 是 | 1 | 商品状态:0仓库(未上架)、1上架、2下架、3违规下架、4回收站等 |
| ... | ||||
| sku_value | text | 是 | 商品规格属性(商品参数) | |
| goods_tags | varchar(2000) | 是 | 商品标签(如:近期销量飙升,30天上新,近7天同类热卖,24小时内发货,等等,用逗号隔开) | |
| ... | ||||
| order | int(11) | 是 | 50 | 排序,默认50 |
| status | int(1) | 否 | 1 | 可用状态:0禁用、1启用 |
| create_time | datetime | 否 | CURRENT_TIMESTAMP | 数据创建时间 |
| update_time | datetime | 否 | CURRENT_TIMESTAMP | 数据更新时间 |
| delete_time | datetime | 否 | CURRENT_TIMESTAMP | 数据删除时间 |
额外说明:
mysql每行最大只能存65535个字节。假设是utf-8编码,每个字符占3个字节。varchar存储最大字符数为(65535-2-1)/3=21844字符长度
# 创建商品表 goods
# ① 技术栈php(thinkphp)同学
直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。# [商品表]
goods相关【文档】和【接口】
# ② 技术栈node(egg.js)同学
# [商品表]
goods相关【文档】和【接口】
- 直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。- 通过迁移命名创建
goods表:
- 创建迁移文件 命令:
npx sequelize migration:generate --name=goods
- 创建迁移文件
goods.js,内容如下:
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
const {
INTEGER,
STRING,
DATE,
TEXT,
FLOAT,
DECIMAL,
BOOLEAN
} = Sequelize;
await queryInterface.createTable('goods', {
id: {
type: INTEGER(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键id'
},
goods_class_id: {
type: INTEGER(20).UNSIGNED,
allowNull: false,
comment: '商品分类id',
references: { //关联关系
model: 'goods_class', //关联的表
key: 'id' //关联表的主键
},
onDelete: 'CASCADE', //删除时操作
onUpdate: 'RESTRICT', // 更新时操作
},
name: {
type: STRING(255),
allowNull: false,
defaultValue: '',
comment: '商品名称'
},
desc: {
type: STRING(2000),
allowNull: true,
defaultValue: '',
comment: '商品描述'
},
content: {
type: TEXT,
allowNull: true,
comment: '商品详情'
},
cover: {
type: STRING(1000),
allowNull: true,
comment: '商品封面图代表(更多图片关联至goods_banner表)'
},
rating: {
type: FLOAT,
allowNull: true,
defaultValue: 5.0,
comment: '商品评分'
},
sale_count: {
type: INTEGER(11),
allowNull: true,
defaultValue: 0,
comment: '总销量'
},
review_count: {
type: INTEGER(11),
allowNull: true,
defaultValue: 0,
comment: '评论数量'
},
love_count: {
type: INTEGER(11),
allowNull: true,
defaultValue: 0,
comment: '收藏量'
},
recommend_count: {
type: INTEGER(11),
allowNull: true,
defaultValue: 0,
comment: '推荐量'
},
min_price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '起售价(最低售价,多少元起)'
},
history_min_price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '历史最低价'
},
coupon_price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '券后价'
},
discount_price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '折后价'
},
spike_price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '秒杀价'
},
other_price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '其它设置价(如:首件价,新客价,30天低价等等)'
},
unit: {
type: STRING(10),
allowNull: true,
defaultValue: '件',
comment: '商品单位(默认:件)'
},
stock: {
type: INTEGER(11),
allowNull: true,
defaultValue: 0,
comment: '库存'
},
min_stock: {
type: INTEGER(11),
allowNull: true,
defaultValue: 0,
comment: '库存预警'
},
stock_display: {
type: INTEGER(1),
allowNull: true,
defaultValue: 0,
comment: '库存显示:0隐藏 1显示'
},
ischeck: {
type: INTEGER(1),
allowNull: true,
defaultValue: 0,
comment: '审核状态:0审核中 1通过 2拒绝(不通过)'
},
goods_status: {
type: INTEGER(1),
allowNull: true,
defaultValue: 1,
comment: '商品状态:0仓库(未上架)、1上架、2下架、3违规下架、4回收站等'
},
sku_value: {
type: TEXT,
allowNull: true,
comment: '商品规格属性(商品参数)'
},
goods_tags: {
type: STRING(2000),
allowNull: true,
comment: '商品标签(如:近期销量飙升,30天上新,近7天同类热卖,24小时内发货,等等,用逗号隔开)'
},
order: {
type: INTEGER,
allowNull: true,
defaultValue: 50,
comment: '排序,默认50'
},
status: {
type: INTEGER(1),
allowNull: false,
defaultValue: 1,
comment: '可用状态:0禁用 1启用'
},
create_time: {
type: DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP'),
comment: '创建时间'
},
update_time: {
type: DATE,
allowNull: false,
defaultValue: Sequelize.literal('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'),
comment: '更新时间'
},
delete_time: {
type: DATE,
allowNull: true,
comment: '删除时间'
}
});
// 添加索引优化查询
await queryInterface.addIndex('goods', ['goods_class_id']);
await queryInterface.addIndex('goods', ['status']);
await queryInterface.addIndex('goods', ['goods_status']);
},
async down(queryInterface) {
await queryInterface.dropTable('goods');
}
};
- 执行迁移文件命令生成数据库表:
// 创建数据库 npx sequelize db:migrate // 如果有问题需要回滚,可以通过 `db:migrate:undo` 回退一个变更 npx sequelize db:migrate:undo // 可以通过 `db:migrate:undo:all` 回退到初始状态 npx sequelize db:migrate:undo:all
# 2. 商品表goods的外联表goods_banner[商品图片表]字段设计
| 字段名 | 数据类型及描述 | 空 | 默认值 | 字段含义 |
|---|---|---|---|---|
| id | int(20) 主键、自增长、UNSIGNED无符号 | 否 | 主键id | |
| goods_id | int(20) | 否 | 商品goods表的id | |
| url | varchar(1000) | 否 | 商品图片地址 | |
| order | int(11) | 是 | 50 | 排序,默认50 |
| status | int(1) | 否 | 1 | 可用状态:0禁用1启用 |
| create_time | datetime | 否 | CURRENT_TIMESTAMP | 数据创建时间 |
| update_time | datetime | 否 | CURRENT_TIMESTAMP | 数据更新时间 |
# 创建商品图片表 goods_banner
- 直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。- 通过迁移命名创建
goods_banner表:
- 创建迁移文件 命令:
npx sequelize migration:generate --name=goods_banner
- 创建迁移文件
goods_banner.js,内容如下:
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up (queryInterface, Sequelize) {
const { INTEGER, STRING, DATE, ENUM, TEXT, BIGINT} = Sequelize;
// 创建表 --- 类似我们sql语句定义表结构
await queryInterface.createTable('goods_banner', {
id: {
type: INTEGER(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键id'
},
goods_id:{
type: INTEGER(20).UNSIGNED,
allowNull: false,
// defaultValue:0,
comment: '商品id',
references: { //关联关系
model: 'goods', //关联的表
key: 'id' //关联表的主键
},
onDelete: 'cascade', //删除时操作
onUpdate: 'restrict', // 更新时操作
},
url: {
type: STRING(1000),
allowNull: false,
defaultValue: '',
comment: '图片地址'
},
order: {
type: INTEGER,//不限定长度.默认int(11)
allowNull: true,
defaultValue: 50,
comment: '排序,默认50'
},
status:{
type: INTEGER(1),
allowNull: false,
defaultValue:1,
comment: '状态:1:启用,0:禁用'
},
// sex: { type: ENUM, values: ['男','女','保密'], allowNull: true, defaultValue: '保密', comment: '留言用户性别'},
create_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')},
update_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')}
});
},
async down (queryInterface, Sequelize) {
await queryInterface.dropTable('goods_banner')
}
};
- 执行迁移文件命令生成数据库表:
// 创建数据库 npx sequelize db:migrate // 如果有问题需要回滚,可以通过 `db:migrate:undo` 回退一个变更 npx sequelize db:migrate:undo // 可以通过 `db:migrate:undo:all` 回退到初始状态 npx sequelize db:migrate:undo:all
# 3. 商品表goods的外联表goods_param[商品参数表]字段设计
| 字段名 | 数据类型及描述 | 空 | 默认值 | 字段含义 |
|---|---|---|---|---|
| id | int(20) 主键、自增长、UNSIGNED无符号 | 否 | 主键id | |
| goods_id | int(20) | 否 | 商品goods表的id | |
| paraminfo | varchar(5000) | 否 | 商品参数信息(skus表每个属性的键值对数据) | |
| order | int(11) | 是 | 50 | 排序,默认50 |
| status | int(1) | 否 | 1 | 可用状态:0禁用1启用 |
| create_time | datetime | 否 | CURRENT_TIMESTAMP | 数据创建时间 |
| update_time | datetime | 否 | CURRENT_TIMESTAMP | 数据更新时间 |
# 创建商品参数表 goods_param
- 直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。- 通过迁移命名创建
goods_param表:
- 创建迁移文件 命令:
npx sequelize migration:generate --name=goods_param
- 创建迁移文件
goods_param.js,内容如下:
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up (queryInterface, Sequelize) {
const { INTEGER, STRING, DATE, ENUM, TEXT, BIGINT} = Sequelize;
// 创建表 --- 类似我们sql语句定义表结构
await queryInterface.createTable('goods_param', {
id: {
type: INTEGER(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键id'
},
goods_id:{
type: INTEGER(20).UNSIGNED,
allowNull: false,
// defaultValue:0,
comment: '商品id',
references: { //关联关系
model: 'goods', //关联的表
key: 'id' //关联表的主键
},
onDelete: 'cascade', //删除时操作
onUpdate: 'restrict', // 更新时操作
},
paraminfo: {
type: STRING(5000),
allowNull: false,
defaultValue: '',
comment: '商品参数信息'
},
order: {
type: INTEGER,//不限定长度.默认int(11)
allowNull: true,
defaultValue: 50,
comment: '排序,默认50'
},
status:{
type: INTEGER(1),
allowNull: false,
defaultValue:1,
comment: '状态:1:启用,0:禁用'
},
// sex: { type: ENUM, values: ['男','女','保密'], allowNull: true, defaultValue: '保密', comment: '留言用户性别'},
create_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')},
update_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')}
});
},
async down (queryInterface, Sequelize) {
await queryInterface.dropTable('goods_param')
}
};
- 执行迁移文件命令生成数据库表:
// 创建数据库 npx sequelize db:migrate // 如果有问题需要回滚,可以通过 `db:migrate:undo` 回退一个变更 npx sequelize db:migrate:undo // 可以通过 `db:migrate:undo:all` 回退到初始状态 npx sequelize db:migrate:undo:all
# 4. 商品表goods的选购sku表goods_sku[商品选购sku表]字段设计
| 字段名 | 数据类型及描述 | 空 | 默认值 | 字段含义 |
|---|---|---|---|---|
| id | int(20) 主键、自增长、UNSIGNED无符号 | 否 | 主键id | |
| goods_id | int(20) | 否 | 商品goods表的id | |
| name | varchar(255) | 否 | 选购组合名称 | |
| namestr | varchar(255) | 否 | 选购组合名称纯文字 | |
| cover | varchar(2000) | 是 | 选购组合封面图 | |
| stock | int(11) | 是 | 0 | 商品选购组合库存数量 |
| price | decimal(10,2) | 是 | 商品选购组合价格 | |
| special_price | decimal(10,2) | 是 | 商品选购组合优惠价格 | |
| order | int(11) | 是 | 50 | 排序,默认50 |
| status | int(1) | 否 | 1 | 可用状态:0禁用1启用 |
| create_time | datetime | 否 | CURRENT_TIMESTAMP | 数据创建时间 |
| update_time | datetime | 否 | CURRENT_TIMESTAMP | 数据更新时间 |
# 创建商品参数表 goods_sku
- 直接在
phpMyAdmin中根据表字段设计创建表,或者通过数据库插件写sql语句创建表。- 通过迁移命名创建
goods_sku表:
- 创建迁移文件 命令:
npx sequelize migration:generate --name=goods_sku
- 创建迁移文件
goods_sku.js,内容如下:
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up (queryInterface, Sequelize) {
const { INTEGER, STRING, DATE, ENUM, TEXT, BIGINT,DECIMAL} = Sequelize;
// 创建表 --- 类似我们sql语句定义表结构
await queryInterface.createTable('goods_sku', {
id: {
type: INTEGER(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键id'
},
goods_id:{
type: INTEGER(20).UNSIGNED,
allowNull: false,
// defaultValue:0,
comment: '商品id',
references: { //关联关系
model: 'goods', //关联的表
key: 'id' //关联表的主键
},
onDelete: 'cascade', //删除时操作
onUpdate: 'restrict', // 更新时操作
},
name: {
type: STRING(255),
allowNull: false,
defaultValue: '',
comment: '选购组合名称'
},
namestr: {
type: STRING(255),
allowNull: false,
defaultValue: '',
comment: '选购组合名称纯文字'
},
cover: {
type: STRING(2000),
allowNull: true,
defaultValue: '',
comment: '选购组合封面图'
},
stock: {
type: INTEGER,//不限定长度.默认int(11)
allowNull: true,
defaultValue: 0,
comment: '商品选购组合库存数量'
},
price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '商品选购组合价格'
},
special_price: {
type: DECIMAL(10, 2),
allowNull: true,
comment: '商品选购组合优惠价格'
},
order: {
type: INTEGER,//不限定长度.默认int(11)
allowNull: true,
defaultValue: 50,
comment: '排序,默认50'
},
status:{
type: INTEGER(1),
allowNull: false,
defaultValue:1,
comment: '状态:1:启用,0:禁用'
},
// sex: { type: ENUM, values: ['男','女','保密'], allowNull: true, defaultValue: '保密', comment: '留言用户性别'},
create_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')},
update_time: {type: DATE, allowNull: false, defaultValue:Sequelize.fn('NOW')}
});
},
async down (queryInterface, Sequelize) {
await queryInterface.dropTable('goods_sku')
}
};
- 执行迁移文件命令生成数据库表:
// 创建数据库 npx sequelize db:migrate // 如果有问题需要回滚,可以通过 `db:migrate:undo` 回退一个变更 npx sequelize db:migrate:undo // 可以通过 `db:migrate:undo:all` 回退到初始状态 npx sequelize db:migrate:undo:all