<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class CrearTablaCurso extends Migration
{
    public function up()
    {
        $this->forge->addField([
            'curso_id' => [
                'type' => 'INT',
                'unsigned' => true,
                'auto_increment' => true,
                'null' => false,
            ],
            'curso_nombre' => [
                'type' => 'VARCHAR',
                'constraint' => 150,
                'null' => false,
            ],
            'curso_estado' => [
                'type' => 'BOOL',
                'null' => false,
            ],
            'created_at timestamp default current_timestamp',
            'updated_at timestamp default current_timestamp on update current_timestamp'
        ]);

        $this->forge->addKey("curso_id",true);
        $this->forge->createTable("curso");
    }

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