2020_12_17_172306_create_owner_contracts_table.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateOwnerContractsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('owner_contracts', function (Blueprint $table) {
  15. $table->id();
  16. $table->string("contract_number",30)->index()->comment("合同号");
  17. $table->string("salesman",20)->comment("销售名称");
  18. $table->string("remark")->comment("备注");
  19. $table->bigInteger("owner_id")->comment("外键货主");
  20. $table->timestamps();
  21. });
  22. Schema::table("owners",function (Blueprint $table){
  23. $table->dropColumn("contract_number");
  24. $table->dropColumn("salesman");
  25. });
  26. Schema::table("upload_files",function (Blueprint $table){
  27. $table->string("file_name")->nullable();
  28. });
  29. }
  30. /**
  31. * Reverse the migrations.
  32. *
  33. * @return void
  34. */
  35. public function down()
  36. {
  37. Schema::dropIfExists('owner_contracts');
  38. Schema::table("owners",function (Blueprint $table){
  39. $table->string('contract_number')->nullable()->comment('合同号');
  40. $table->string('salesman')->nullable()->comment('销售名称');
  41. });
  42. Schema::table("upload_files",function (Blueprint $table){
  43. $table->dropColumn("file_name");
  44. });
  45. }
  46. }