Initial commit BIJ CI4

This commit is contained in:
BIJ Dev
2026-04-21 05:49:17 +07:00
commit fa38ac6b24
13170 changed files with 866701 additions and 0 deletions

View File

View File

@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateAdminActivityLogs extends Migration
{
public function up(): void
{
$this->forge->addField([
'id' => [
'type' => 'BIGINT',
'unsigned' => true,
'auto_increment' => true,
],
'admin_user' => [
'type' => 'VARCHAR',
'constraint' => 191,
'default' => '',
],
'action' => [
'type' => 'VARCHAR',
'constraint' => 128,
'default' => '',
],
'endpoint' => [
'type' => 'VARCHAR',
'constraint' => 512,
'default' => '',
],
'payload' => [
'type' => 'TEXT',
'null' => true,
],
'ip_address' => [
'type' => 'VARCHAR',
'constraint' => 45,
'default' => '',
],
'user_agent' => [
'type' => 'VARCHAR',
'constraint' => 512,
'default' => '',
],
'auth_source' => [
'type' => 'VARCHAR',
'constraint' => 32,
'null' => true,
],
'roles_json' => [
'type' => 'TEXT',
'null' => true,
],
'outcome' => [
'type' => 'VARCHAR',
'constraint' => 32,
'default' => 'success',
],
'created_at' => [
'type' => 'DATETIME',
'null' => false,
],
]);
$this->forge->addKey('id', true);
$this->forge->addKey('created_at');
$this->forge->addKey(['action', 'created_at']);
$this->forge->createTable('admin_activity_logs', true, [
'ENGINE' => 'InnoDB',
]);
}
public function down(): void
{
$this->forge->dropTable('admin_activity_logs', true);
}
}

View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class AddIdPegawaiToAdminUsers extends Migration
{
public function up(): void
{
if (! $this->db->tableExists('admin_users')) {
return;
}
if ($this->db->fieldExists('id_pegawai', 'admin_users')) {
return;
}
$this->forge->addColumn('admin_users', [
'id_pegawai' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => true,
'null' => true,
],
]);
}
public function down(): void
{
if (! $this->db->tableExists('admin_users')) {
return;
}
if (! $this->db->fieldExists('id_pegawai', 'admin_users')) {
return;
}
$this->forge->dropColumn('admin_users', 'id_pegawai');
}
}