Merge branch 'pipi/ujrah_staging' into ujrah_master_fix
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateTransaksiGadaiTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
protected $connection = 'mysql7';
|
||||
|
||||
public function up()
|
||||
{
|
||||
Schema::create('transaksi_gadai', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('kodcaw', 10);
|
||||
$table->string('norujukan', 50);
|
||||
$table->decimal('bakipjm', 9, 2);
|
||||
$table->decimal('tempoh', 9, 2);
|
||||
$table->date('t_update');
|
||||
$table->decimal('bakihargajualan', 9, 2);
|
||||
$table->decimal('tempohbayar', 9, 2);
|
||||
$table->integer('lelong_tawarruq');
|
||||
$table->decimal('margin_semasa', 9, 2);
|
||||
$table->decimal('tunggakanujrah', 9, 2);
|
||||
$table->decimal('tunggakanonepercent', 9, 2);
|
||||
$table->decimal('percentpinj', 9, 2);
|
||||
$table->integer('transaction_id');
|
||||
$table->integer('transaksiupah_id');
|
||||
$table->integer('softDelete');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('transaksi_gadai');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddTagTebusToGadai extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function getActiveDB(){
|
||||
$config_db = array_keys(config("database.connections"));
|
||||
|
||||
$db_connection = array_filter($config_db,function($connection){
|
||||
try{
|
||||
if($connection == 'mysql7' || $connection == 'lelong')
|
||||
return false;
|
||||
|
||||
$db = DB::connection($connection)->getPdo();
|
||||
return true;
|
||||
} catch(\Exception $e){
|
||||
Log::info($connection);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return $db_connection;
|
||||
}
|
||||
|
||||
public function up()
|
||||
{
|
||||
$db_connection = $this->getActiveDB();
|
||||
|
||||
foreach($db_connection as $dbase){
|
||||
Schema::connection($dbase)->table('gadai', function (Blueprint $table) use($dbase) {
|
||||
|
||||
$isTagTebus = Schema::connection($dbase)->hasColumn('gadai', 'tag_tebus');
|
||||
|
||||
if(! $isTagTebus){
|
||||
$table->char('tag_tebus', 2);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('gadai', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user