<?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()
    {
        // 执行原生 SQL 语句
        DB::statement("CREATE TABLE `ufutx_s2_real_object_stock_operate` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `user_id` bigint(20) NOT NULL COMMENT '操作人id',
  `operate_name` varchar(255) DEFAULT NULL COMMENT '操作人名',
  `operate_mobile` varchar(64) DEFAULT NULL COMMENT '操作人电话',
  `operate_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0=入库 1=出库',
  `real_ids` varchar(256) NOT NULL COMMENT '实物id,逗号分隔',
  `before_num` varchar(256) NOT NULL COMMENT '修改之前数量,逗号分隔',
  `modify_num` varchar(256) NOT NULL COMMENT '修改数量,负数则减,正数则加,逗号分隔',
  `after_num` varchar(256) NOT NULL COMMENT '修改之后数量,逗号分隔',
  `order_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT '订单id,如果有',
  `express_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT '快递/自提id',
  `check_user_id` bigint(20) UNSIGNED DEFAULT NULL COMMENT '审核人用户id',
  `check_name` varchar(255) DEFAULT NULL COMMENT '审核人',
  `check_mobile` varchar(64) DEFAULT NULL COMMENT '审核人电话',
  `check_remark` text COMMENT '审核建议',
  `images` text COMMENT '照片多个',
  `contract_id` varchar(255) DEFAULT NULL COMMENT '合同id',
  `remark` text COMMENT '操作备注信息',
  `status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0=未审核 1=审核通过 2=审核拒绝',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='实物入库记录表';");
    }

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