@@ -122,6 +122,8 @@ class FixSchoolYearColumns extends Migration
|
||||
);
|
||||
}
|
||||
|
||||
$this->db->resetDataCache();
|
||||
|
||||
// These annual entities lacked a school_year column in the audited schema.
|
||||
foreach (['class_progress_reports', 'exams', 'print_requests'] as $table) {
|
||||
if ($this->db->tableExists($table) && ! $this->db->fieldExists('school_year', $table)) {
|
||||
@@ -137,6 +139,8 @@ class FixSchoolYearColumns extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->resetDataCache();
|
||||
|
||||
// Validate and normalize every direct owner to VARCHAR(9).
|
||||
foreach ($this->yearOwnerTables as $table) {
|
||||
if (! $this->db->tableExists($table) || ! $this->db->fieldExists('school_year', $table)) {
|
||||
@@ -163,6 +167,8 @@ class FixSchoolYearColumns extends Migration
|
||||
}
|
||||
}
|
||||
|
||||
$this->db->resetDataCache();
|
||||
|
||||
// Remove redundant columns. Dependent non-primary indexes are removed first.
|
||||
foreach ($this->tablesWithoutDirectYear as $table) {
|
||||
if (! $this->db->tableExists($table) || ! $this->db->fieldExists('school_year', $table)) {
|
||||
@@ -172,6 +178,7 @@ class FixSchoolYearColumns extends Migration
|
||||
$this->dropIndexesContainingColumn($table, 'school_year');
|
||||
$this->dropChecksContainingColumn($table, 'school_year');
|
||||
$this->forge->dropColumn($table, 'school_year');
|
||||
$this->db->resetDataCache();
|
||||
}
|
||||
|
||||
foreach ($this->tablesWithoutDirectSemester as $table) {
|
||||
@@ -182,8 +189,11 @@ class FixSchoolYearColumns extends Migration
|
||||
$this->dropIndexesContainingColumn($table, 'semester');
|
||||
$this->dropChecksContainingColumn($table, 'semester');
|
||||
$this->forge->dropColumn($table, 'semester');
|
||||
$this->db->resetDataCache();
|
||||
}
|
||||
|
||||
$this->db->resetDataCache();
|
||||
|
||||
foreach ($this->yearOwnerTables as $table) {
|
||||
if (! $this->db->tableExists($table) || ! $this->db->fieldExists('school_year', $table)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user