<?php

namespace App\Database\Migrations\Master;

use CodeIgniter\Database\Migration;

class Pengumuman extends Migration
{
    public function up()
    {
        $fields = [
            'id'   => ['type' => 'int', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
            'judul' => ['type' => 'varchar', 'constraint' => 255],
            'tujuan' =>  ['type' => 'enum', 'constraint' => ['1', '2'], 'default' => '1'],
            'body' => ['type' => 'text',  'null' => true],
            'created_at datetime default current_timestamp',
        ];
        $this->forge->addField($fields);
        $this->forge->addKey('id', true);
        $this->forge->createTable('pengumuman', true);
    }

    public function down()
    {
        $this->forge->dropTable('pengumuman', true);
    }
}
