This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user