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

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('costs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('business_id');
$table->string('type');
$table->date('month');
$table->unsignedInteger('amount');
$table->unsignedInteger('fee')->default(0);
$table->unsignedInteger('duration');
$table->unsignedInteger('cost')->storedAs('fee*duration');
$table->unsignedFloat('tax', 8, 2)->storedAs('(cost/100)*9');
$table->json('additional')->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('costs');
}
}