fix pages and add distribution system
Tests / PHPUnit (push) Failing after 1m13s

This commit is contained in:
root
2026-07-15 23:03:51 -04:00
parent 7f3b24e47f
commit ba87598d3a
38 changed files with 1362 additions and 658 deletions
@@ -31,8 +31,8 @@ class CreateStudentSectionDistributionDrafts extends Migration
$this->forge->addKey('id', true);
$this->forge->addUniqueKey(['student_id', 'school_year'], 'unique_distribution_draft_student_year');
$this->forge->addKey(['class_id', 'school_year', 'status'], false, 'distribution_draft_class_year_status');
$this->forge->addKey(['class_section_id', 'school_year'], false, 'distribution_draft_section_year');
$this->forge->addKey(['class_id', 'school_year', 'status'], false, false, 'distribution_draft_class_year_status');
$this->forge->addKey(['class_section_id', 'school_year'], false, false, 'distribution_draft_section_year');
$this->forge->createTable('student_section_distribution_drafts');
}
@@ -0,0 +1,54 @@
<?php
namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class FixStudentSectionDistributionDraftIndexes extends Migration
{
public function up()
{
if (! $this->db->tableExists('student_section_distribution_drafts')) {
return;
}
$this->dropIndexIfExists('student_section_distribution_drafts', 'class_id_school_year_status');
$this->dropIndexIfExists('student_section_distribution_drafts', 'class_section_id_school_year');
$this->dropIndexIfExists('student_section_distribution_drafts', 'distribution_draft_class_year_status');
$this->dropIndexIfExists('student_section_distribution_drafts', 'distribution_draft_section_year');
$this->db->query(
'CREATE INDEX distribution_draft_class_year_status ' .
'ON student_section_distribution_drafts (class_id, school_year, status)'
);
$this->db->query(
'CREATE INDEX distribution_draft_section_year ' .
'ON student_section_distribution_drafts (class_section_id, school_year)'
);
}
public function down()
{
if (! $this->db->tableExists('student_section_distribution_drafts')) {
return;
}
$this->dropIndexIfExists('student_section_distribution_drafts', 'distribution_draft_class_year_status');
$this->dropIndexIfExists('student_section_distribution_drafts', 'distribution_draft_section_year');
}
private function dropIndexIfExists(string $table, string $indexName): void
{
$row = $this->db->query(
'SHOW INDEX FROM ' . $this->db->protectIdentifiers($table, true) .
' WHERE Key_name = ' . $this->db->escape($indexName)
)->getRowArray();
if ($row) {
$this->db->query(
'ALTER TABLE ' . $this->db->protectIdentifiers($table, true) .
' DROP INDEX ' . $this->db->protectIdentifiers($indexName)
);
}
}
}