feat: add provider model and bridging schemas
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('providers', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('organization_id')->constrained('organizations')->cascadeOnDelete();
|
||||
$table->string('username');
|
||||
$table->string('password');
|
||||
$table->string('code')->nullable();
|
||||
$table->string('status')->default('active');
|
||||
$table->string('header_token', 255)->nullable();
|
||||
$table->string('token', 255)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['organization_id', 'username']);
|
||||
$table->index(['organization_id', 'code', 'status']);
|
||||
$table->index('token');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('providers');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('request_logs', function (Blueprint $table) {
|
||||
if (!Schema::hasColumn('request_logs', 'plan_id')) {
|
||||
$table->unsignedBigInteger('plan_id')->nullable()->after('member_id');
|
||||
$table->index('plan_id');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('request_logs', 'admission_date')) {
|
||||
$table->dateTime('admission_date')->nullable()->after('submission_date');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('request_logs', 'nomor_sep')) {
|
||||
$table->string('nomor_sep')->nullable()->after('keterangan');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('request_logs', 'status_rujukan')) {
|
||||
$table->string('status_rujukan')->nullable()->after('nomor_sep');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('request_logs', 'nomor_rujukan')) {
|
||||
$table->string('nomor_rujukan')->nullable()->after('status_rujukan');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('request_logs', 'no_transaksi_provider')) {
|
||||
$table->string('no_transaksi_provider')->nullable()->after('nomor_rujukan');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('request_logs', 'inacbgs_code')) {
|
||||
$table->string('inacbgs_code')->nullable()->after('no_transaksi_provider');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('request_logs', 'inacbgs_amount')) {
|
||||
$table->decimal('inacbgs_amount', 18, 2)->nullable()->after('inacbgs_code');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('request_logs', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('request_logs', 'inacbgs_amount')) {
|
||||
$table->dropColumn('inacbgs_amount');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('request_logs', 'inacbgs_code')) {
|
||||
$table->dropColumn('inacbgs_code');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('request_logs', 'no_transaksi_provider')) {
|
||||
$table->dropColumn('no_transaksi_provider');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('request_logs', 'nomor_rujukan')) {
|
||||
$table->dropColumn('nomor_rujukan');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('request_logs', 'status_rujukan')) {
|
||||
$table->dropColumn('status_rujukan');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('request_logs', 'nomor_sep')) {
|
||||
$table->dropColumn('nomor_sep');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('request_logs', 'admission_date')) {
|
||||
$table->dropColumn('admission_date');
|
||||
}
|
||||
|
||||
if (Schema::hasColumn('request_logs', 'plan_id')) {
|
||||
$table->dropIndex(['plan_id']);
|
||||
$table->dropColumn('plan_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user