52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateKriteriaTable extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
$this->forge->addField([
|
|
'id' => [
|
|
'type' => 'INT',
|
|
'unsigned' => true,
|
|
'auto_increment' => true,
|
|
],
|
|
'nama_kriteria' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 100,
|
|
'null' => false,
|
|
],
|
|
'type' => [
|
|
'type' => 'ENUM',
|
|
'constraint' => ['cost', 'benefit'],
|
|
'null' => false,
|
|
],
|
|
'bobot' => [
|
|
'type' => 'DECIMAL',
|
|
'constraint' => '4,2', // total 4 digit, 2 di belakang koma, max 99.99
|
|
'null' => false,
|
|
'default' => 0.00,
|
|
],
|
|
'created_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
'updated_at' => [
|
|
'type' => 'DATETIME',
|
|
'null' => true,
|
|
],
|
|
]);
|
|
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->createTable('kriteria');
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('kriteria');
|
|
}
|
|
}
|