41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
final class DropUnusedInvoiceOpeningPaidBalances extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
if ($this->db->tableExists('invoice_opening_paid_balances')) {
|
|
$this->forge->dropTable('invoice_opening_paid_balances', true);
|
|
$this->db->resetDataCache();
|
|
}
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
if ($this->db->tableExists('invoice_opening_paid_balances')) {
|
|
return;
|
|
}
|
|
|
|
$this->db->query(
|
|
"CREATE TABLE `invoice_opening_paid_balances` (
|
|
`invoice_id` INT UNSIGNED NOT NULL,
|
|
`amount` DECIMAL(10,2) NOT NULL,
|
|
`effective_before_payment_id` INT UNSIGNED DEFAULT NULL,
|
|
`school_year` VARCHAR(9) NOT NULL,
|
|
`evidence_reference` VARCHAR(255) NOT NULL,
|
|
`approved_by` INT UNSIGNED NOT NULL,
|
|
`approved_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
`notes` TEXT,
|
|
PRIMARY KEY (`invoice_id`)
|
|
) ENGINE=InnoDB"
|
|
);
|
|
$this->db->resetDataCache();
|
|
}
|
|
}
|