@@ -169,28 +169,9 @@ 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)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->dropIndexesContainingColumn($table, 'school_year');
|
||||
$this->dropChecksContainingColumn($table, 'school_year');
|
||||
$this->forge->dropColumn($table, 'school_year');
|
||||
$this->db->resetDataCache();
|
||||
}
|
||||
|
||||
foreach ($this->tablesWithoutDirectSemester as $table) {
|
||||
if (! $this->db->tableExists($table) || ! $this->db->fieldExists('semester', $table)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->dropIndexesContainingColumn($table, 'semester');
|
||||
$this->dropChecksContainingColumn($table, 'semester');
|
||||
$this->forge->dropColumn($table, 'semester');
|
||||
$this->db->resetDataCache();
|
||||
}
|
||||
// Do not drop redundant school_year/semester columns here. Restored
|
||||
// production dumps may still contain meaningful historical data in
|
||||
// those columns, and running migrate must not destroy it.
|
||||
|
||||
$this->db->resetDataCache();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user