<?php

namespace App\Database\Migrations;

use CodeIgniter\Database\Migration;

class AddOauthFieldsToSchoolSettings extends Migration
{
    public function up()
    {
        $fields = [
            'google_client_id' => [
                'type' => 'TEXT',
                'null' => true,
                'after' => 'google_drive_key'
            ],
            'google_client_secret' => [
                'type' => 'TEXT',
                'null' => true,
                'after' => 'google_client_id'
            ],
            'google_refresh_token' => [
                'type' => 'TEXT',
                'null' => true,
                'after' => 'google_client_secret'
            ]
        ];

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

    public function down()
    {
        $this->forge->dropColumn('school_settings', 'google_client_id');
        $this->forge->dropColumn('school_settings', 'google_client_secret');
        $this->forge->dropColumn('school_settings', 'google_refresh_token');
    }
}
