<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class Dokumen extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'id_dokumen' => [
                'type'           => 'INT',
                'constraint'     => 11,
                'unsigned'       => true,
                'auto_increment' => true,
            ],
            'judul_dokumen' => [
                'type'       => 'VARCHAR',
                'constraint' => '255',
            ],
            'kategori' => [
                'type'       => 'VARCHAR',
                'constraint' => '100',
            ],
            'nama_file' => [
                'type'       => 'VARCHAR',
                'constraint' => '255',
            ],
            'tanggal_upload' => [
                'type' => 'DATE',
            ],
        ]);
        $this->forge->addKey('id_dokumen', true);
        $this->forge->createTable('tb_dokumen');
    }

    public function down()
    {
        $this->forge->dropTable('tb_dokumen');
    }
}