<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class Structure extends Migration
{
    public function up()
    {
        //
        $this->forge->addField([
            'code_str'       => ['type' => 'INT', 'unsigned' => true, 'null' => false],
            'nom_str'        => ['type' => 'VARCHAR', 'constraint' => 100],
            'type_str'       => ['type' => 'VARCHAR', 'constraint' => 100],
            'created_at'     => ['type' => 'DATETIME', 'null' => true],
            'updated_at'     => ['type' => 'DATETIME', 'null' => true],
            'deleted_at'     => ['type' => 'DATETIME', 'null' => true],
        ]);
        
        $this->forge->addKey('code_str', true); // Primary key
        $this->forge->createTable('structure');
    }

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