fix(migration): perbaiki model Branch dan struktur migrasi pengguna
- Memperbaiki import model Branch dari Modules\Basicdata\Models\Branch. - Menambahkan kolom 'nik' yang nullable setelah kolom 'email'. - Menambahkan foreign key untuk 'branch_id' yang nullable setelah kolom 'nik'. - Memperbaiki metode up dan down untuk migrasi pengguna.
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Modules\Lpj\Models\Branch;
|
use Modules\Basicdata\Models\Branch;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
public function up(): void
|
public function up()
|
||||||
|
: void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->string('nik')->nullable()->after('email');
|
$table->string('nik')->nullable()->after('email');
|
||||||
@@ -21,7 +21,8 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
/**
|
/**
|
||||||
* Reverse the migrations.
|
* Reverse the migrations.
|
||||||
*/
|
*/
|
||||||
public function down(): void
|
public function down()
|
||||||
|
: void
|
||||||
{
|
{
|
||||||
Schema::table('users', function (Blueprint $table) {
|
Schema::table('users', function (Blueprint $table) {
|
||||||
$table->dropColumn('nik');
|
$table->dropColumn('nik');
|
||||||
@@ -29,4 +30,4 @@ use Illuminate\Support\Facades\Schema;
|
|||||||
$table->dropColumn('branch_id');
|
$table->dropColumn('branch_id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user