2021_01_28_162431_add_column_discount_date.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. $table->decimal("total_discount_price")->nullable()->comment("减免总价");
  18. });
  19. Schema::table('owner_fee_details', function (Blueprint $table) {
  20. $table->bigInteger("owner_price_operation_id")->nullable()->comment("引用的计费模型");
  21. $table->dropIndex(["worked_at"]);
  22. $table->index(["worked_at","owner_price_operation_id"]);
  23. });
  24. }
  25. /**
  26. * Reverse the migrations.
  27. *
  28. * @return void
  29. */
  30. public function down()
  31. {
  32. Schema::table('owner_price_operations', function (Blueprint $table) {
  33. $table->dropColumn("discount_date");
  34. $table->dropColumn("total_price");
  35. $table->dropColumn("total_discount_price");
  36. });
  37. Schema::table('owner_fee_details', function (Blueprint $table) {
  38. $table->dropColumn("owner_price_operation_id");
  39. $table->dropIndex([["worked_at","owner_price_operation_id"]]);
  40. $table->index(["worked_at"]);
  41. });
  42. }
  43. }