2021_01_13_103331_create_yz_logistics_set.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateYzLogisticsSet extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. //
  15. if (!Schema::hasTable('yz_logistics_set')) {
  16. Schema::create('yz_logistics_set', function (Blueprint $table) {
  17. $table->increments('id');
  18. $table->integer('uniacid')->default(0);
  19. $table->integer('type')->default(0)->comment('类型');
  20. $table->text('data')->nullable()->comment('设置数据');
  21. $table->integer('status')->default(0)->nullable()->comment('状态');
  22. $table->integer('created_at')->nullable();
  23. $table->integer('updated_at')->nullable();
  24. });
  25. $list = \Illuminate\Support\Facades\DB::table('yz_setting')->where('group','shop')->where('key','express_info')->get();
  26. $data = [];
  27. foreach ($list as $item) {
  28. \Illuminate\Support\Facades\DB::table('yz_logistics_set')->insert([
  29. 'uniacid' => $item['uniacid'],
  30. 'data' => $item['value'],
  31. 'type' => 1
  32. ]);
  33. }
  34. \Illuminate\Support\Facades\DB::statement("ALTER TABLE `" . app('db')->getTablePrefix() . "yz_logistics_set` comment'物流查询设置表'");//表注释
  35. }
  36. }
  37. /**
  38. * Reverse the migrations.
  39. *
  40. * @return void
  41. */
  42. public function down()
  43. {
  44. //
  45. Schema::dropIfExists('dispatch_classify');
  46. }
  47. }