2021_01_28_162431_add_column_discount_date.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class AddColumnDiscountDate extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::table('owner_price_operations', function (Blueprint $table) {
  15. $table->date("discount_date")->nullable()->comment("满减标记日");
  16. $table->decimal("total_price")->nullable()->comment("按单计价");
  17. });
  18. Schema::table('owner_fee_details', function (Blueprint $table) {
  19. $table->bigInteger("owner_price_operation_id")->nullable()->comment("引用的计费模型");
  20. $table->dropIndex(["worked_at"]);
  21. $table->index(["worked_at","owner_price_operation_id"]);
  22. });
  23. }
  24. /**
  25. * Reverse the migrations.
  26. *
  27. * @return void
  28. */
  29. public function down()
  30. {
  31. Schema::table('owner_price_operations', function (Blueprint $table) {
  32. $table->dropColumn("discount_date");
  33. $table->dropColumn("total_price");
  34. });
  35. Schema::table('owner_fee_details', function (Blueprint $table) {
  36. $table->dropColumn("owner_price_operation_id");
  37. $table->dropIndex([["worked_at","owner_price_operation_id"]]);
  38. $table->index(["worked_at"]);
  39. });
  40. }
  41. }