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

40 lines
1.1 KiB
PHTML

3 years ago
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateTransactionTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('transactions', function (Blueprint $table) {
$table->id();
3 years ago
$table->integer('category_id')->nullable();
$table->foreign('category_id')->references('id')->on('categories')->nullable();
3 years ago
$table->date('date')->nullable();
$table->decimal('amount', 12, 2)->default(0);
3 years ago
$table->string('description')->nullable();
3 years ago
$table->smallInteger('is_income')->default(0); // 0 expense, 1 income
$table->smallInteger('income_type')->nullable(); // 0 is cash in , 1 is cash out
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('transactions');
}
}