2021_07_01_140836_add_station_datas1.php 7.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\DB;
  5. use Illuminate\Support\Facades\Schema;
  6. class AddStationDatas1 extends Migration
  7. {
  8. /**
  9. * Run the migrations.
  10. *
  11. * @return void
  12. */
  13. public function up()
  14. {
  15. $sqls=["delete from bswas.stations where id>0;"
  16. ,"insert into bswas.stations (id,station_type_id)values(1,1),(2,1),(4,1),(6,1),(7,1),(10,1),(11,1),(12,1),(13,1),(14,1),(15,1),(16,1),(17,1),(18,1),(19,1),(20,1),(21,1),(22,1),(23,1),(24,1),(25,1),(26,1),(27,1),(28,1);"
  17. ,"UPDATE bswas.stations SET parent_id = 2, name = 'U型线入货口01', code = 'BIN-OUT1', station_type_id = 1, sequence = 1, created_at = '2020-12-02 13:46:55', updated_at = '2020-12-02 13:46:55' WHERE id = 1;"
  18. ,"UPDATE bswas.stations SET parent_id = null, name = '料箱监视器01', code = 'ULine01', station_type_id = 3, sequence = 1, created_at = '2020-12-04 18:16:36', updated_at = '2020-12-04 18:16:36' WHERE id = 2;"
  19. ,"UPDATE bswas.stations SET parent_id = null, name = '立库', code = null, station_type_id = 4, sequence = 1, created_at = '2021-03-30 16:19:33', updated_at = '2021-03-30 17:00:20' WHERE id = 4;"
  20. ,"UPDATE bswas.stations SET parent_id = null, name = '缓存架01', code = 'B1', station_type_id = 5, sequence = null, created_at = '2021-04-27 14:11:56', updated_at = '2021-05-13 16:37:55' WHERE id = 6;"
  21. ,"UPDATE bswas.stations SET parent_id = null, name = '缓存架02', code = 'B2', station_type_id = 5, sequence = null, created_at = '2021-04-27 14:11:56', updated_at = '2021-05-13 16:37:55' WHERE id = 7;"
  22. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-02-02', code = 'HAIB1-02-02', station_type_id = 5, sequence = null, created_at = '2021-05-13 16:47:55', updated_at = '2021-05-13 16:47:55' WHERE id = 10;"
  23. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-01-01', code = 'HAIB1-01-01', station_type_id = 5, sequence = null, created_at = '2021-05-18 16:54:16', updated_at = '2021-05-18 16:54:16' WHERE id = 11;"
  24. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-01-02', code = 'HAIB1-01-02', station_type_id = 5, sequence = null, created_at = '2021-05-21 15:12:28', updated_at = '2021-05-21 15:12:28' WHERE id = 12;"
  25. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-01-03', code = 'HAIB1-01-03', station_type_id = 5, sequence = null, created_at = '2021-05-21 15:12:28', updated_at = '2021-05-21 15:12:28' WHERE id = 13;"
  26. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-02-01', code = 'HAIB1-02-01', station_type_id = 5, sequence = null, created_at = '2021-05-21 15:12:28', updated_at = '2021-05-21 15:12:28' WHERE id = 14;"
  27. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-02-03', code = 'HAIB1-02-03', station_type_id = 5, sequence = null, created_at = '2021-05-21 15:12:28', updated_at = '2021-05-21 15:12:28' WHERE id = 15;"
  28. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-03-01', code = 'HAIB1-03-01', station_type_id = 5, sequence = null, created_at = '2021-05-21 15:12:28', updated_at = '2021-05-21 15:12:28' WHERE id = 16;"
  29. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-03-02', code = 'HAIB1-03-02', station_type_id = 5, sequence = null, created_at = '2021-05-21 15:12:29', updated_at = '2021-05-21 15:12:29' WHERE id = 17;"
  30. ,"UPDATE bswas.stations SET parent_id = 6, name = 'HAIB1-03-03', code = 'HAIB1-03-03', station_type_id = 5, sequence = null, created_at = '2021-05-21 15:12:29', updated_at = '2021-05-21 15:12:29' WHERE id = 18;"
  31. ,"UPDATE bswas.stations SET parent_id = 2, name = 'U型线拍灯01', code = 'IN1-01-01', station_type_id = 6, sequence = null, created_at = '2021-06-04 09:06:35', updated_at = '2021-06-04 09:06:35' WHERE id = 19;"
  32. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-01-01', code = 'HAIB2-01-01', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 20;"
  33. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-01-02', code = 'HAIB2-01-02', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 21;"
  34. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-01-03', code = 'HAIB2-01-03', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 22;"
  35. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-02-01', code = 'HAIB2-02-01', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 23;"
  36. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-02-02', code = 'HAIB2-02-02', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 24;"
  37. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-02-03', code = 'HAIB2-02-03', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 25;"
  38. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-03-01', code = 'HAIB2-03-01', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 26;"
  39. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-03-02', code = 'HAIB2-03-02', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 27;"
  40. ,"UPDATE bswas.stations SET parent_id = 7, name = 'HAIB2-03-03', code = 'HAIB2-03-03', station_type_id = 5, sequence = null, created_at = '2021-06-28 00:00:00', updated_at = '2021-06-28 00:00:00' WHERE id = 28;"
  41. ,"delete from bswas.station_types where id>0;"
  42. ,"insert into bswas.station_types (id,name)values(1,''),(2,''),(3,''),(4,''),(5,''),(6,''),(7,'');"
  43. ,"UPDATE bswas.station_types SET name = '料箱出货口', created_at = '2020-12-02 13:46:55', updated_at = '2020-12-02 13:46:55' WHERE id = 1;"
  44. ,"UPDATE bswas.station_types SET name = '料箱入货口', created_at = '2020-12-02 13:46:55', updated_at = '2020-12-02 13:46:55' WHERE id = 2;"
  45. ,"UPDATE bswas.station_types SET name = '料箱监视器', created_at = '2020-12-02 13:46:55', updated_at = '2020-12-02 13:46:55' WHERE id = 3;"
  46. ,"UPDATE bswas.station_types SET name = '立库', created_at = '2021-03-30 16:19:56', updated_at = '2021-03-30 16:19:58' WHERE id = 4;"
  47. ,"UPDATE bswas.station_types SET name = '缓存架', created_at = '2021-04-27 14:11:56', updated_at = '2021-04-27 14:11:56' WHERE id = 5;"
  48. ,"UPDATE bswas.station_types SET name = 'U型线拍灯', created_at = '2021-06-04 09:06:35', updated_at = '2021-06-04 09:06:35' WHERE id = 6;"
  49. ,"UPDATE bswas.station_types SET name = '镜像架', created_at = '2021-06-07 18:35:50', updated_at = '2021-06-07 18:35:50' WHERE id = 7;"
  50. ];
  51. array_walk($sqls,function ($sql){
  52. DB::statement($sql);
  53. });
  54. }
  55. /**
  56. * Reverse the migrations.
  57. *
  58. * @return void
  59. */
  60. public function down()
  61. {
  62. $sql="delete from bswas.stations where id>0;";
  63. DB::statement($sql);
  64. }
  65. }