Files
lelong/database/migrations/2023_04_04_083509_create_notis_table.php
T
2023-04-17 09:24:52 +08:00

90 lines
3.1 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNotisTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notis', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('tarikh_notis')->nullable();
$table->string('daritempoh')->nullable();
$table->string('hinggatempoh')->nullable();
$table->integer('sts_notis')->nullable();
$table->integer('fasa')->nullable();
$table->timestamps();
});
Schema::create('notisbid', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('notis_id')->unsigned();
$table->string('tarikh_notis');
$table->unsignedBigInteger('caw_id')->unsigned();
$table->string('kodcaw');
$table->string('norujukan');
$table->string('nokp');
$table->decimal('jbg', $precision = 7, $scale = 2);
$table->decimal('kadarupah', $precision = 5, $scale = 2)->nullable();
$table->decimal('nilaimarhun', $precision = 9, $scale = 2);
$table->decimal('pinjaman', $precision = 9, $scale = 2)->nullable();
$table->decimal('bakiupah', $precision = 7, $scale = 2);
$table->decimal('berat', $precision = 7, $scale = 2);
$table->string('marhun');
$table->decimal('percent', $precision = 7, $scale = 2);
$table->integer('fasa')->default(0);
$table->date('tarikhnotis1')->nullable();
$table->date('tarikhnotis2')->nullable();
$table->timestamps();
$table->foreign('caw_id')
->references('id')->on('cawangan')
->onDelete('cascade');
$table->foreign('notis_id')
->references('id')->on('notis')
->onDelete('cascade');
});
Schema::create('cawangan_notis', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('notis_id')->unsigned();
$table->unsignedBigInteger('caw_id')->unsigned();
$table->integer('fasa')->default(0);
$table->string('daritempoh')->nullable();
$table->string('hinggatempoh')->nullable();
$table->integer('status')->nullable();
$table->timestamps();
$table->foreign('caw_id')
->references('id')->on('cawangan')
->onDelete('cascade');
$table->foreign('notis_id')
->references('id')->on('notis')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notis');
Schema::dropIfExists('notisbid');
Schema::dropIfExists('cawangan_notis');
}
}