<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddStorageSettingsToSchoolSettings extends Migration
{
    public function up()
    {
        $fields = [
            'storage_driver' => [
                'type'       => 'VARCHAR',
                'constraint' => 50,
                'default'    => 'local',
                'after'      => 'logo_sekolah'
            ],
            'google_drive_folder_id' => [
                'type' => 'TEXT',
                'null' => true,
                'after' => 'storage_driver'
            ],
            'google_drive_key' => [
                'type' => 'TEXT',
                'null' => true,
                'after' => 'google_drive_folder_id'
            ]
        ];

        $this->forge->addColumn('school_settings', $fields);
    }

    public function down()
    {
        $this->forge->dropColumn('school_settings', 'storage_driver');
        $this->forge->dropColumn('school_settings', 'google_drive_folder_id');
        $this->forge->dropColumn('school_settings', 'google_drive_key');
    }
}
