diff --git a/antgoods/migrations/m191119_021851_create_table_shop_category.php b/antgoods/migrations/m191119_021851_create_table_shop_category.php new file mode 100644 index 0000000..35f536e --- /dev/null +++ b/antgoods/migrations/m191119_021851_create_table_shop_category.php @@ -0,0 +1,42 @@ +createTable('antgoods_shop_category', [ + 'id' => $this->primaryKey(), + 'name'=>$this->string(60)->notNull()->comment('类别名称'), + 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), + 'goods_count'=>$this->integer(11)->defaultValue(0)->comment('商品数量'), + 'keywords'=>$this->string(100)->defaultValue(null)->comment('关键字'), + 'desc'=>$this->string(255)->defaultValue(null)->comment('描述'), + 'sort_order'=>$this->smallInteger(3)->defaultValue(0)->comment('排序'), + 'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'), + 'icon'=>$this->string(64)->defaultValue(null)->comment('图标'), + 'filter_attr'=>$this->text()->comment('筛选属性'), + 'is_show'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否显示,1为不显示'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), + 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), + 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), + ],$tableOptions); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable('antgoods_shop_category'); + return true; + } +} diff --git a/antgoods/migrations/m191119_022641_create_table_category.php b/antgoods/migrations/m191119_022641_create_table_category.php new file mode 100644 index 0000000..60dd21e --- /dev/null +++ b/antgoods/migrations/m191119_022641_create_table_category.php @@ -0,0 +1,39 @@ +createTable('antgoods_category', [ + 'id' => $this->primaryKey(), + 'name'=>$this->string(60)->notNull()->comment('类别名称'), + 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'), + 'goods_count'=>$this->integer(11)->defaultValue(0)->comment('商品数量'), + 'sort_order'=>$this->smallInteger(3)->defaultValue(0)->comment('排序'), + 'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'), + 'icon'=>$this->string(64)->defaultValue(null)->comment('图标'), + 'is_show'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否显示,1为不显示'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), + 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), + 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), + ],$tableOptions); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable('antgoods_category'); + return true; + } +} diff --git a/antgoods/migrations/m191119_022939_create_table_attribute.php b/antgoods/migrations/m191119_022939_create_table_attribute.php new file mode 100644 index 0000000..8f77f8f --- /dev/null +++ b/antgoods/migrations/m191119_022939_create_table_attribute.php @@ -0,0 +1,36 @@ +createTable('antgoods_attribute', [ + 'id' => $this->primaryKey(), + 'name'=>$this->string(50)->notNull()->comment('属性名'), + 'value'=>$this->text()->notNull()->comment('属性值'), + 'type'=>$this->smallInteger(2)->defaultValue(null)->comment('类型'), + 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), + 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), + 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), + ],$tableOptions); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable('antgoods_attribute'); + return true; + } +} diff --git a/antgoods/migrations/m191119_023115_create_table_goods_attr.php b/antgoods/migrations/m191119_023115_create_table_goods_attr.php new file mode 100644 index 0000000..19a263c --- /dev/null +++ b/antgoods/migrations/m191119_023115_create_table_goods_attr.php @@ -0,0 +1,35 @@ +createTable('antgoods_goods_attr', [ + 'id' => $this->primaryKey(), + 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'), + 'attr_id'=>$this->integer(11)->notNull()->comment('属性id'), + 'attr_value'=>$this->string(50)->notNull()->comment('属性名'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), + 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), + 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), + ],$tableOptions); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable('antgoods_goods_attr'); + return true; + } +} diff --git a/antgoods/migrations/m191119_024029_create_table_brand.php b/antgoods/migrations/m191119_024029_create_table_brand.php new file mode 100644 index 0000000..48984d4 --- /dev/null +++ b/antgoods/migrations/m191119_024029_create_table_brand.php @@ -0,0 +1,33 @@ +createTable('antgoods_brand', [ + 'id' => $this->primaryKey(), + 'name'=>$this->string(50)->notNull()->comment('品牌名'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), + 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), + 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), + ],$tableOptions); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable('antgoods_brand'); + return true; + } +} diff --git a/antgoods/migrations/m191119_024205_create_table_goods.php b/antgoods/migrations/m191119_024205_create_table_goods.php new file mode 100644 index 0000000..d16c1e5 --- /dev/null +++ b/antgoods/migrations/m191119_024205_create_table_goods.php @@ -0,0 +1,27 @@ +execute($sql); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable("antgoods_goods"); + return true; + } +} diff --git a/antgoods/migrations/m191119_024345_create_table_goods_sku.php b/antgoods/migrations/m191119_024345_create_table_goods_sku.php new file mode 100644 index 0000000..227b38b --- /dev/null +++ b/antgoods/migrations/m191119_024345_create_table_goods_sku.php @@ -0,0 +1,27 @@ +execute($sql); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable("antgoods_goods_sku"); + return true; + } +} diff --git a/antgoods/migrations/m191119_025607_create_table_supplier.php b/antgoods/migrations/m191119_025607_create_table_supplier.php new file mode 100644 index 0000000..c7d8f6c --- /dev/null +++ b/antgoods/migrations/m191119_025607_create_table_supplier.php @@ -0,0 +1,36 @@ +createTable('antgoods_supplier', [ + 'id' => $this->primaryKey(), + 'name'=>$this->string(50)->notNull()->comment('供应商名称'), + 'full_name'=>$this->string(50)->notNull()->comment('供应商全称'), + 'phone'=>$this->string(20)->notNull()->comment('手机号码'), + 'address'=>$this->string(50)->notNull()->comment('地址'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), + 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), + 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), + ],$tableOptions); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable('antgoods_supplier'); + return true; + } +} diff --git a/antgoods/migrations/m191119_025843_create_table_filter_attr.php b/antgoods/migrations/m191119_025843_create_table_filter_attr.php new file mode 100644 index 0000000..0409292 --- /dev/null +++ b/antgoods/migrations/m191119_025843_create_table_filter_attr.php @@ -0,0 +1,35 @@ +createTable('antgoods_filter_attr', [ + 'id' => $this->primaryKey(), + 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'), + 'attr_id'=>$this->integer(11)->notNull()->comment('属性id'), + 'attr_value'=>$this->string(50)->notNull()->comment('属性值'), + 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'), + 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), + 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), + ],$tableOptions); + } + + /** + * {@inheritdoc} + */ + public function down() + { + $this->dropTable('antgoods_filter_attr'); + return true; + } +} diff --git a/antgoods/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php b/antgoods/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php new file mode 100644 index 0000000..00fb52e --- /dev/null +++ b/antgoods/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php @@ -0,0 +1,22 @@ +dropColumn('antgoods_category', 'icon_type'); + $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(1)->comment('图标类型')); + } + + public function down() + { + $this->dropColumn('antgoods_category', 'icon_type'); + $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型')); + return true; + } +} diff --git a/antgoods/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php b/antgoods/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php new file mode 100644 index 0000000..04c6a2b --- /dev/null +++ b/antgoods/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php @@ -0,0 +1,20 @@ +dropColumn('antgoods_category', 'icon_type'); + } + + public function down() + { + $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型')); + return true; + } +} diff --git a/antgoods/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php b/antgoods/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php new file mode 100644 index 0000000..055e84c --- /dev/null +++ b/antgoods/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php @@ -0,0 +1,26 @@ +dropColumn('antgoods_category', 'icon'); + $this->addColumn('antgoods_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标')); + $this->dropColumn('antgoods_category', 'pid'); + $this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id')); + } + + public function down() + { + $this->dropColumn('antgoods_category', 'icon'); + $this->addColumn('antgoods_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标')); + $this->dropColumn('antgoods_category', 'pid'); + $this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id')); + return true; + } +} diff --git a/antgoods/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php b/antgoods/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php new file mode 100644 index 0000000..2f182eb --- /dev/null +++ b/antgoods/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php @@ -0,0 +1,20 @@ +dropColumn('antgoods_shop_category', 'icon_type'); + } + + public function down() + { + $this->addColumn('antgoods_shop_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型')); + return true; + } +} diff --git a/antgoods/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php b/antgoods/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php new file mode 100644 index 0000000..b1536ac --- /dev/null +++ b/antgoods/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php @@ -0,0 +1,26 @@ +dropColumn('antgoods_shop_category', 'icon'); + $this->addColumn('antgoods_shop_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标')); + $this->dropColumn('antgoods_shop_category', 'pid'); + $this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id')); + } + + public function down() + { + $this->dropColumn('antgoods_shop_category', 'icon'); + $this->addColumn('antgoods_shop_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标')); + $this->dropColumn('antgoods_shop_category', 'pid'); + $this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id')); + return true; + } +} diff --git a/antgoods/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php b/antgoods/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php new file mode 100644 index 0000000..a6584d6 --- /dev/null +++ b/antgoods/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php @@ -0,0 +1,20 @@ +addColumn('antgoods_goods_sku', 'is_manaul', $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否手动')); + } + + public function down() + { + $this->dropColumn('antgoods_goods_sku', 'is_manaul'); + return true; + } +} diff --git a/antgoods/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php b/antgoods/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php new file mode 100644 index 0000000..3d4b3ed --- /dev/null +++ b/antgoods/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php @@ -0,0 +1,20 @@ +addColumn('antgoods_goods', 'sku_mode', $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('sku类型')); + } + + public function down() + { + $this->dropColumn('antgoods_goods', 'sku_mode'); + return true; + } +} diff --git a/antgoods/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php b/antgoods/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php new file mode 100644 index 0000000..3ee066e --- /dev/null +++ b/antgoods/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php @@ -0,0 +1,26 @@ +dropColumn('antgoods_goods_attr', 'goods_id'); + $this->dropColumn('antgoods_goods_attr', 'attr_id'); + $this->addColumn('antgoods_goods_attr', 'goods_id', $this->integer(11)->notNull()->defaultValue(0)->comment('商品id')); + $this->addColumn('antgoods_goods_attr', 'attr_id', $this->integer(11)->notNull()->defaultValue(0)->comment('属性id')); + } + + public function down() + { + $this->dropColumn('antgoods_goods_attr', 'goods_id'); + $this->dropColumn('antgoods_goods_attr', 'attr_id'); + $this->addColumn('antgoods_goods_attr', 'goods_id', $this->integer(11)->notNull()->comment('商品id')); + $this->addColumn('antgoods_goods_attr', 'attr_id', $this->integer(11)->notNull()->comment('属性id')); + return true; + } +} diff --git a/antgoods/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php b/antgoods/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php new file mode 100644 index 0000000..f7992f5 --- /dev/null +++ b/antgoods/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php @@ -0,0 +1,20 @@ +addColumn('antgoods_attribute', 'cat_id', $this->integer(11)->notNull()->defaultValue(0)->comment('后台商品分类id')); + } + + public function down() + { + $this->dropColumn('antgoods_attribute', 'cat_id'); + return true; + } +} diff --git a/antgoods/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php b/antgoods/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php new file mode 100644 index 0000000..52d5ca7 --- /dev/null +++ b/antgoods/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php @@ -0,0 +1,27 @@ +dropColumn('antgoods_goods_sku', 'weight'); + $this->dropColumn('antgoods_goods_sku', 'length'); + $this->dropColumn('antgoods_goods_sku', 'width'); + $this->dropColumn('antgoods_goods_sku', 'height'); + $this->dropColumn('antgoods_goods_sku', 'diameter'); + } + + public function down() + { + $this->addColumn('antgoods_goods_sku', 'weight', $this->integer(8)->defaultValue(null)->comment('重量')); + $this->addColumn('antgoods_goods_sku', 'length', $this->integer(8)->defaultValue(null)->comment('长度')); + $this->addColumn('antgoods_goods_sku', 'width', $this->integer(8)->defaultValue(null)->comment('宽度')); + $this->addColumn('antgoods_goods_sku', 'height', $this->integer(8)->defaultValue(null)->comment('高度')); + $this->addColumn('antgoods_goods_sku', 'diameter', $this->integer(8)->defaultValue(null)->comment('直径')); + } +} diff --git a/antgoods/migrations/sql/goods.sql b/antgoods/migrations/sql/goods.sql new file mode 100755 index 0000000..3944770 --- /dev/null +++ b/antgoods/migrations/sql/goods.sql @@ -0,0 +1,37 @@ +DROP TABLE IF EXISTS `antgoods_goods`; +CREATE TABLE `antgoods_goods` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `pid` int(11) DEFAULT NULL COMMENT '父级id', + `cat_id` int(11) NOT NULL COMMENT '后台商品类别id', + `brand_id` int(11) NOT NULL COMMENT '品牌id', + `shop_cat_id` int(11) NOT NULL COMMENT '前端商品类别id', + `name` varchar(120) NOT NULL COMMENT '商品名称', + `sn` varchar(60) DEFAULT NULL COMMENT '商品唯一货号', + `code` varchar(50) DEFAULT NULL COMMENT '商品货码', + `supplier_id` int(11) DEFAULT NULL COMMENT '供应商id', + `weight` mediumint(8) DEFAULT NULL unique COMMENT '重量', + `length` mediumint(8) DEFAULT NULL unique COMMENT '长度', + `width` mediumint(8) DEFAULT NULL unique COMMENT '宽度', + `height` mediumint(8) DEFAULT NULL unique COMMENT '高度', + `diameter` mediumint(8) DEFAULT NULL unique COMMENT '直径', + `unit` varchar(16) DEFAULT NULL COMMENT '单位', + `sold_count` int(10) DEFAULT NULL unique COMMENT '已售数量', + `limit_count` int(10) DEFAULT NULL COMMENT '限购数量', + `stock` int(10) DEFAULT NULL COMMENT '库存', + `stock_warn` int(10) DEFAULT NULL COMMENT '库存警告', + `market_price` int(20) DEFAULT NULL unique COMMENT '市场价', + `price` int(20) DEFAULT NULL unique COMMENT '销售价', + `brief` varchar(255) DEFAULT NULL COMMENT '简介', + `description` text COMMENT '详细介绍', + `image` int(11) DEFAULT NULL COMMENT '图片id', + `model_id` int(11) DEFAULT NULL COMMENT '模型id', + `is_sale` tinyint(1) DEFAULT '0' COMMENT '该商品是否开放销售,1为是,0为否', + `sort_order` smallint(3) DEFAULT NULL COMMENT '排序', + `bouns_points` mediumint(8) DEFAULT NULL COMMENT '奖励积分', + `experience_points` mediumint(8) DEFAULT NULL COMMENT '经验值', + `is_delete` tinyint(1) DEFAULT '0' COMMENT '是否删除,1为已删除', + `express_template` int(11) DEFAULT NULL COMMENT '配送详情id', + `created_at` int(10) DEFAULT '0' COMMENT '创建时间', + `updated_at` int(10) DEFAULT '0' COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品表'; \ No newline at end of file diff --git a/antgoods/migrations/sql/goods_sku.sql b/antgoods/migrations/sql/goods_sku.sql new file mode 100755 index 0000000..a599a39 --- /dev/null +++ b/antgoods/migrations/sql/goods_sku.sql @@ -0,0 +1,24 @@ +DROP TABLE IF EXISTS `antgoods_goods_sku`; +CREATE TABLE `antgoods_goods_sku` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `goods_id` int(11) NOT NULL COMMENT '商品id', + `goods_code` varchar(50) DEFAULT NULL COMMENT '商品条码', + `goods_sn` varchar(60) NOT NULL COMMENT '商品唯一货号', + `goods_attr` varchar(60) DEFAULT NULL COMMENT '属性匹配', + `weight` mediumint(8) DEFAULT NULL COMMENT '重量', + `length` mediumint(8) DEFAULT NULL COMMENT '长度', + `width` mediumint(8) DEFAULT NULL COMMENT '宽度', + `height` mediumint(8) DEFAULT NULL COMMENT '高度', + `diameter` mediumint(8) DEFAULT NULL COMMENT '直径', + `sold_count` int(10) DEFAULT NULL COMMENT '已售数量', + `stock` int(10) DEFAULT NULL COMMENT '库存', + `market_price` int(20) DEFAULT NULL COMMENT '市场价', + `price` int(20) DEFAULT NULL COMMENT '销售价', + `model_id` int(11) DEFAULT NULL COMMENT '模型id', + `is_sale` tinyint(1) DEFAULT '0' COMMENT '该商品是否开放销售,1为是,0为否', + `sort_order` smallint(3) DEFAULT '0' COMMENT '排序', + `is_delete` tinyint(1) DEFAULT '0' COMMENT '是否删除,1为已删除', + `created_at` int(10) DEFAULT '0' COMMENT '创建时间', + `updated_at` int(10) DEFAULT '0' COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品sku表'; \ No newline at end of file