2019_04_24_151910_add_form_id.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class AddFormId extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. { //添加字段
  14. if (Schema::hasTable('yz_member_mini_app')) {
  15. if (!Schema::hasColumn('yz_member_mini_app', 'formId')) {
  16. Schema::table('yz_member_mini_app', function (Blueprint $table) {
  17. $table->string('formId')->nullable();
  18. $table->string('formId_create_time')->nullable();
  19. });
  20. }
  21. }
  22. }
  23. /**
  24. * Reverse the migrations.
  25. *
  26. * @return void
  27. */
  28. public function down()
  29. {
  30. if (Schema::hasTable('yz_member_mini_app')) {
  31. if (Schema::hasColumn('yz_member_mini_app', 'formId')) {
  32. Schema::table('yz_member_mini_app', function (Blueprint $table) {
  33. $table->dropColumn('formId_create_time');
  34. $table->dropColumn('formId');
  35. });
  36. }
  37. }
  38. //
  39. }
  40. }