2020_07_21_104613_change_package_columns_decimal.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class ChangePackageColumnsDecimal extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::table('packages',function (Blueprint $table){
  15. $table->decimal('weight',10,2)->comment('重KG')->change();
  16. $table->decimal('length',10,2)->comment('长(cm)')->change();
  17. $table->decimal('width',10,2)->comment('宽(cm)')->change();
  18. $table->decimal('height',10,2)->comment('高(cm)')->change();
  19. $table->decimal('bulk',16,2)->nullable()->comment('体积(cm³)')->change();
  20. });
  21. }
  22. /**
  23. * Reverse the migrations.
  24. *
  25. * @return void
  26. */
  27. public function down()
  28. {
  29. Schema::table('packages', function (Blueprint $table) {
  30. $table->decimal('weight',8,2)->nullable()->comment('重KG')->change();
  31. $table->decimal('length',8,2)->nullable()->comment('长(cm)')->change();
  32. $table->decimal('width',8,2)->nullable()->comment('宽(cm)')->change();
  33. $table->decimal('height',8,2)->nullable()->comment('高(cm)')->change();
  34. $table->decimal('bulk',8,2)->nullable()->comment('体积(cm³)')->change();
  35. });
  36. }
  37. }