MIF_E31220334/app/Database/Migrations/2025-05-24-052536_CreateSub...

38 lines
927 B
PHP

<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class CreateSubKriteriaTable extends Migration
{
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => true,
'auto_increment' => true,
],
'kriteria_id' => [
'type' => 'INT',
'unsigned' => true,
'null' => false,
],
'nama' => [
'type' => 'VARCHAR',
'constraint' => 100,
],
]);
$this->forge->addKey('id', true);
$this->forge->addForeignKey('kriteria_id', 'kriteria', 'id', 'CASCADE', 'CASCADE');
$this->forge->createTable('sub_kriteria');
}
public function down()
{
$this->forge->dropTable('sub_kriteria');
}
}