fix db delete data issue
Tests / PHPUnit (push) Failing after 1m24s

This commit is contained in:
root
2026-07-13 01:43:32 -04:00
parent f3ac521d7c
commit 504c3bc9f9
12 changed files with 76 additions and 154 deletions
@@ -8,20 +8,8 @@ class RemoveClassAssignmentSemester extends Migration
{
public function up()
{
if ($this->db->tableExists('teacher_class') && $this->db->fieldExists('semester', 'teacher_class')) {
if ($this->indexExists('teacher_class', 'unique_teacher_assignment')) {
$this->db->query('ALTER TABLE `teacher_class` DROP INDEX `unique_teacher_assignment`');
}
$this->forge->dropColumn('teacher_class', 'semester');
$this->db->query(
'ALTER TABLE `teacher_class` ADD UNIQUE KEY `unique_teacher_assignment` (`teacher_id`, `class_section_id`, `school_year`)'
);
}
if ($this->db->tableExists('student_class') && $this->db->fieldExists('semester', 'student_class')) {
$this->forge->dropColumn('student_class', 'semester');
}
// Keep the legacy semester columns in place. They may be ignored by newer
// code, but dropping them during a post-restore migrate destroys data.
}
public function down()