Initial commit BIJ CI4
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user