update api ticket type
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
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
|
||||
if (!Schema::hasColumn('users', 'username')) {
|
||||
$table->string('username')->nullable()->unique()->after('name');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('users', 'status')) {
|
||||
$table->enum('status', [
|
||||
'active',
|
||||
'inactive',
|
||||
'suspended'
|
||||
])->default('active');
|
||||
}
|
||||
|
||||
if (!Schema::hasColumn('users', 'last_login_at')) {
|
||||
$table->timestamp('last_login_at')->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
|
||||
$table->dropColumn([
|
||||
'username',
|
||||
'status',
|
||||
'last_login_at'
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tenants', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->string('tenant_code')->unique();
|
||||
|
||||
$table->string('tenant_name');
|
||||
|
||||
$table->string('phone')->nullable();
|
||||
|
||||
$table->string('email')->nullable();
|
||||
|
||||
$table->text('address')->nullable();
|
||||
|
||||
$table->enum('status', [
|
||||
'active',
|
||||
'inactive'
|
||||
])->default('active');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('tenants');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_tenants', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('user_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->foreignId('tenant_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->boolean('is_default')
|
||||
->default(false);
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique([
|
||||
'user_id',
|
||||
'tenant_id'
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_tenants');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('menu_lists', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('parent_id')
|
||||
->nullable()
|
||||
->constrained('menu_lists')
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->string('name');
|
||||
|
||||
$table->string('slug')->unique();
|
||||
|
||||
$table->string('url')->nullable();
|
||||
|
||||
$table->string('icon')->nullable();
|
||||
|
||||
$table->string('component')->nullable();
|
||||
|
||||
$table->integer('sort_order')->default(0);
|
||||
|
||||
$table->boolean('is_active')->default(true);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('menu_lists');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('menu_groups', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->string('name')->unique();
|
||||
|
||||
$table->text('description')->nullable();
|
||||
|
||||
$table->boolean('is_active')->default(true);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('menu_groups');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('menu_group_menus', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('menu_group_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->foreignId('menu_id')
|
||||
->constrained('menu_lists')
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->boolean('can_view')->default(false);
|
||||
|
||||
$table->boolean('can_create')->default(false);
|
||||
|
||||
$table->boolean('can_update')->default(false);
|
||||
|
||||
$table->boolean('can_delete')->default(false);
|
||||
|
||||
$table->boolean('can_approve')->default(false);
|
||||
|
||||
$table->boolean('can_export')->default(false);
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique([
|
||||
'menu_group_id',
|
||||
'menu_id'
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('menu_group_menus');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_menu_groups', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('user_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->foreignId('menu_group_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->foreignId('tenant_id')
|
||||
->nullable()
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique([
|
||||
'user_id',
|
||||
'menu_group_id',
|
||||
'tenant_id'
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_menu_groups');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_profiles', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('user_id')
|
||||
->unique()
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->string('nik', 30)->nullable();
|
||||
|
||||
$table->string('phone', 30)->nullable();
|
||||
|
||||
$table->text('address')->nullable();
|
||||
|
||||
$table->unsignedBigInteger('provinsi_id')->nullable();
|
||||
|
||||
$table->unsignedBigInteger('kabupaten_id')->nullable();
|
||||
|
||||
$table->unsignedBigInteger('kecamatan_id')->nullable();
|
||||
|
||||
$table->unsignedBigInteger('desa_id')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_profiles');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('wilayah_provinsi', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->string('kode', 20)->unique();
|
||||
|
||||
$table->string('nama');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('wilayah_provinsi');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('wilayah_kabupaten', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('provinsi_id')
|
||||
->constrained('wilayah_provinsi')
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->string('kode', 20)->unique();
|
||||
|
||||
$table->string('nama');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('wilayah_kabupaten');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('wilayah_kecamatan', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('kabupaten_id')
|
||||
->constrained('wilayah_kabupaten')
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->string('kode', 20)->unique();
|
||||
|
||||
$table->string('nama');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('wilayah_kecamatan');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('wilayah_desa', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('kecamatan_id')
|
||||
->constrained('wilayah_kecamatan')
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->string('kode', 20)->unique();
|
||||
|
||||
$table->string('nama');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('wilayah_desa');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('audit_logs', function (Blueprint $table) {
|
||||
|
||||
$table->id();
|
||||
|
||||
$table->foreignId('user_id')
|
||||
->nullable()
|
||||
->constrained('users')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->foreignId('tenant_id')
|
||||
->nullable()
|
||||
->constrained('tenants')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->string('module', 100);
|
||||
|
||||
$table->string('action', 50);
|
||||
|
||||
$table->string('table_name', 100)
|
||||
->nullable();
|
||||
|
||||
$table->unsignedBigInteger('record_id')
|
||||
->nullable();
|
||||
|
||||
$table->json('old_values')
|
||||
->nullable();
|
||||
|
||||
$table->json('new_values')
|
||||
->nullable();
|
||||
|
||||
$table->string('ip_address', 50)
|
||||
->nullable();
|
||||
|
||||
$table->text('user_agent')
|
||||
->nullable();
|
||||
|
||||
$table->text('description')
|
||||
->nullable();
|
||||
|
||||
$table->timestamp('created_at')
|
||||
->useCurrent();
|
||||
|
||||
$table->index('user_id');
|
||||
$table->index('tenant_id');
|
||||
$table->index('module');
|
||||
$table->index('action');
|
||||
$table->index('record_id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('audit_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user