Files
exchange-2.0/database/migrations/2020_11_03_122319_create_documents_table.php
T
CheeSiong 98b354d6b2 document
2020-11-18 10:37:03 +08:00

43 lines
1.2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDocumentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('documents', function (Blueprint $table) {
$table->id();
$table->integer('owner_id')->nullable();
$table->integer('owner_type')->nullable();
$table->string('document_type')->nullable();
$table->string('reference')->nullable();
$table->integer('status')->nullable();
$table->bigInteger('approved_by')->unsigned()->nullable();
$table->foreign('approved_by')->references('id')->on('users')->onDelete('cascade');
$table->timestamp('issued_date')->nullable();
$table->timestamp('expired_date')->nullable();
$table->timestamp('approved_date')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('documents');
}
}