You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateCostsTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('costs', function (Blueprint $table) {
  15. $table->id();
  16. $table->unsignedBigInteger('business_id');
  17. $table->string('type');
  18. $table->date('month');
  19. $table->unsignedInteger('amount');
  20. $table->unsignedInteger('fee')->default(0);
  21. $table->unsignedInteger('duration');
  22. $table->unsignedInteger('cost')->storedAs('fee*duration');
  23. $table->unsignedFloat('tax', 8, 2)->storedAs('(cost/100)*9');
  24. $table->json('additional')->nullable();
  25. $table->timestamp('created_at')->nullable();
  26. $table->timestamp('updated_at')->useCurrent();
  27. });
  28. }
  29. /**
  30. * Reverse the migrations.
  31. *
  32. * @return void
  33. */
  34. public function down()
  35. {
  36. Schema::dropIfExists('costs');
  37. }
  38. }