fix teacher pages display between school years
Tests / PHPUnit (push) Failing after 1m12s

This commit is contained in:
root
2026-07-15 20:52:19 -04:00
parent 5f27dccd0f
commit 9de2ab2a9f
9 changed files with 106 additions and 53 deletions
@@ -8,13 +8,20 @@ class RemoveClassAssignmentSemester extends Migration
{
public function up()
{
// Keep the legacy semester columns in place. They may be ignored by newer
// code, but dropping them during a post-restore migrate destroys data.
if (
$this->db->tableExists('teacher_class')
&& $this->db->fieldExists('semester', 'teacher_class')
) {
$this->forge->dropColumn('teacher_class', 'semester');
}
}
public function down()
{
if ($this->db->tableExists('teacher_class')) {
if (
$this->db->tableExists('teacher_class')
&& ! $this->db->fieldExists('semester', 'teacher_class')
) {
$this->forge->addColumn('teacher_class', [
'semester' => [
'type' => 'VARCHAR',
@@ -24,16 +31,6 @@ class RemoveClassAssignmentSemester extends Migration
],
]);
}
if ($this->db->tableExists('student_class')) {
$this->forge->addColumn('student_class', [
'semester' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => false,
'default' => '',
],
]);
}
}
private function indexExists(string $table, string $index): bool