43 lines
1.2 KiB
PHP
Executable File
43 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class RemoveClassAssignmentSemester extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
if ($this->db->tableExists('teacher_class')) {
|
|
$this->forge->dropColumn('teacher_class', 'semester');
|
|
}
|
|
if ($this->db->tableExists('student_class')) {
|
|
$this->forge->dropColumn('student_class', 'semester');
|
|
}
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
if ($this->db->tableExists('teacher_class')) {
|
|
$this->forge->addColumn('teacher_class', [
|
|
'semester' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 25,
|
|
'null' => false,
|
|
'default' => '',
|
|
],
|
|
]);
|
|
}
|
|
if ($this->db->tableExists('student_class')) {
|
|
$this->forge->addColumn('student_class', [
|
|
'semester' => [
|
|
'type' => 'VARCHAR',
|
|
'constraint' => 255,
|
|
'null' => false,
|
|
'default' => '',
|
|
],
|
|
]);
|
|
}
|
|
}
|
|
}
|