<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("CREATE TABLE `ufutx_s2_shop_category` (
  `id` int(10) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT COMMENT '其他表应关联此id',
  `name` varchar(256) NOT NULL COMMENT '类型名称'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品类型表';");
        DB::statement("CREATE TABLE `ufutx_s2_shop_spu` (
  `id` bigint(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT COMMENT 'id',
  `category_ids` varchar(128) NOT NULL DEFAULT '1' COMMENT '商品分类id,多个,分割',
  `title` varchar(256) NOT NULL DEFAULT ' ' COMMENT '商品名称',
  `icon` varchar(256) DEFAULT NULL COMMENT '商品图标',
  `banner` text COMMENT '轮播图',
  `description` text COMMENT '商品描述',
  `spec` text COMMENT '规格,json字符串',
  `skuid` bigint(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '默认skuid',
  `platform` varchar(32) NOT NULL DEFAULT '1,2,3' COMMENT '展示平台,h5=1,app=2,mp=3',
  `status` varchar(32) NOT NULL DEFAULT '1,2,3' COMMENT '平台上架,h5=1,app=2,mp=3',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='spu表';");
        DB::statement("CREATE TABLE `ufutx_s2_tpl_price` (
  `id` bigint(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
  `name` varchar(256) NOT NULL COMMENT '模板名称',
  `cond` text NOT NULL COMMENT '条件',
  `rule` text NOT NULL COMMENT '计算规则'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='价格计算模板';");
        DB::statement("CREATE TABLE `ufutx_s2_tpl_freight` (
  `id` bigint(20) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT,
  `name` varchar(256) NOT NULL COMMENT '模板名称',
  `cond` text NOT NULL COMMENT '条件',
  `rule` text NOT NULL COMMENT '计算规则'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='运费计算模板';");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('s2_shop_category');
        Schema::dropIfExists('s2_shop_spu');
        Schema::dropIfExists('s2_tpl_price');
        Schema::dropIfExists('s2_tpl_freight');
    }
};
