Files
exchange-2.0/database/migrations/2020_11_03_122319_create_documents_table.php
omair saleh 05401f6bbc large commit
2021-03-11 13:06:40 +08:00

44 lines
1.2 KiB
PHP

<?php
use App\Classes\ValueObjects\Constants\ApprovalStatus;
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->morphs('owner');
$table->string('document_type');
$table->string('reference');
$table->integer('status')->default(ApprovalStatus::PENDING_VERIFICATION);
$table->timestamp('issued_date')->nullable();
$table->timestamp('expired_date')->nullable();
$table->foreignId('approver')->nullable()->unsigned();
$table->timestamp('approval_date')->nullable();
$table->softDeletes();
$table->timestamps();
$table->foreign('approver')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('documents');
}
}