Files
lelong/database/migrations/2021_12_14_041557_create_lelongs_table.php
T
Azfar Arsyad c32617d44b update
2022-01-11 14:42:18 +08:00

156 lines
6.2 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLelongsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('lelong', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('tarikh_lelong');
$table->time('masamula_lelong')->nullable();
$table->time('masatamat_lelong')->nullable();
$table->dateTime('masakemaskini_data')->nullable();
$table->string('kali')->nullable();
$table->string('harga_emas_asas');
$table->string('jbg');
$table->integer('cajlelong');
$table->integer('sts_lelong')->default(0);
$table->timestamps();
});
Schema::create('cawangan_lelong', function (Blueprint $table) {
$table->bigIncrements('id');
$table->integer('batchlel')->nullable();
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->unsignedBigInteger('caw_id')->unsigned();
$table->string('online');
$table->string('export_data_sts')->nullable();
$table->string('import_data_sts')->nullable();
$table->date('export_data_stsdate')->nullable();
$table->date('import_data_sts_date')->nullable();
$table->string('lokasi');
$table->timestamps();
$table->foreign('caw_id')
->references('id')->on('cawangan')
->onDelete('cascade');
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
Schema::create('lelongbid', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->unsignedBigInteger('caw_id')->unsigned();
$table->string('kodcaw');
$table->string('norujukan');
$table->date('t_lelong');
$table->decimal('hargaasas', $precision = 9, $scale = 2);
$table->decimal('hargajual', $precision = 9, $scale = 2);
$table->date('t_jual')->nullable();
$table->integer('nopembeli')->nullable();
$table->decimal('jbg', $precision = 7, $scale = 2);
$table->decimal('kadarupah', $precision = 5, $scale = 2);
$table->decimal('upahsimpan', $precision = 11, $scale = 2);
$table->decimal('ansuran', $precision = 11, $scale = 2);
$table->decimal('nilaimarhun', $precision = 9, $scale = 2);
$table->decimal('pinjaman', $precision = 9, $scale = 2);
$table->decimal('bakiupah', $precision = 7, $scale = 2);
$table->decimal('cajlain', $precision = 7, $scale = 2);
$table->decimal('cajlelong', $precision = 7, $scale = 2);
$table->decimal('baki', $precision = 9, $scale = 2);
$table->decimal('berat', $precision = 7, $scale = 2);
$table->string('marhun');
$table->decimal('gst_hj', $precision = 7, $scale = 2);
$table->decimal('gst_cl', $precision = 7, $scale = 2);
$table->decimal('percent', $precision = 7, $scale = 2);
$table->string('status_jual');
$table->string('status_payment');
$table->integer('status_semak')->default(0);
$table->string('mora_upah');
$table->timestamps();
$table->foreign('caw_id')
->references('id')->on('cawangan')
->onDelete('cascade');
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
Schema::create('lelongbidmarhun', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('lelongbid_id')->unsigned();
$table->decimal('bil', $precision = 3, $scale = 0);
$table->string('marhun');
$table->string('nota');
$table->string('karat');
$table->decimal('berat', $precision = 7, $scale = 2);
$table->decimal('harga', $precision = 5, $scale = 2);
$table->decimal('n_marhun', $precision = 9, $scale = 2);
$table->decimal('hargaasas', $precision = 11, $scale = 2);
$table->integer('status_semak')->default(0);
$table->timestamps();
$table->foreign('lelongbid_id')
->references('id')->on('lelongbid')
->onDelete('cascade');
});
Schema::create('lelkarat', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->string('karat');
$table->string('keterangan');
$table->decimal('harga', $precision = 5, $scale = 2)->nullable();
$table->decimal('harga2', $precision = 5, $scale = 2)->nullable();
$table->timestamps();
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
Schema::create('lelkarat_temp', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('lelong_id')->unsigned();
$table->string('karat');
$table->string('keterangan');
$table->decimal('harga', $precision = 5, $scale = 2);
$table->decimal('harga2', $precision = 5, $scale = 2);
$table->timestamps();
$table->foreign('lelong_id')
->references('id')->on('lelong')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('lelong');
Schema::dropIfExists('cawangan_lelong');
Schema::dropIfExists('lelongbid');
Schema::dropIfExists('lelongbidmarhun');
Schema::dropIfExists('lelkarat');
Schema::dropIfExists('lelkarat_temp');
}
}