45 lines
2.2 KiB
PHP
45 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class CreateFinancialAidRequests extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
if ($this->db->tableExists('financial_aid_requests')) {
|
|
return;
|
|
}
|
|
|
|
$this->forge->addField([
|
|
'id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true],
|
|
'parent_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true],
|
|
'school_year' => ['type' => 'VARCHAR', 'constraint' => 20],
|
|
'student_ids_json' => ['type' => 'TEXT', 'null' => true],
|
|
'household_size' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'need_statement' => ['type' => 'TEXT'],
|
|
'requested_amount' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
|
|
'status' => ['type' => 'VARCHAR', 'constraint' => 20, 'default' => 'submitted'],
|
|
'admin_amount' => ['type' => 'DECIMAL', 'constraint' => '10,2', 'null' => true],
|
|
'admin_note' => ['type' => 'TEXT', 'null' => true],
|
|
'reviewed_by' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'reviewed_at' => ['type' => 'DATETIME', 'null' => true],
|
|
'invoice_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'discount_usage_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'voucher_id' => ['type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'null' => true],
|
|
'created_at' => ['type' => 'DATETIME', 'null' => true],
|
|
'updated_at' => ['type' => 'DATETIME', 'null' => true],
|
|
]);
|
|
$this->forge->addKey('id', true);
|
|
$this->forge->addKey(['parent_id', 'school_year', 'status'], false, false, 'idx_financial_aid_parent_year_status');
|
|
$this->forge->addKey(['school_year', 'status'], false, false, 'idx_financial_aid_year_status');
|
|
$this->forge->createTable('financial_aid_requests', true);
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
$this->forge->dropTable('financial_aid_requests', true);
|
|
}
|
|
}
|