recreate project
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
|
||||
class AddNoSchoolToCalendarEvents extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
$cols = [];
|
||||
try {
|
||||
$cols = $db->getFieldNames('calendar_events');
|
||||
} catch (\Throwable $e) {
|
||||
$cols = [];
|
||||
}
|
||||
|
||||
if (!in_array('no_school', $cols, true)) {
|
||||
$this->forge->addColumn('calendar_events', [
|
||||
'no_school' => [
|
||||
'type' => 'TINYINT',
|
||||
'constraint' => 1,
|
||||
'null' => false,
|
||||
'default' => 0,
|
||||
'after' => 'notify_teacher',
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
try {
|
||||
$this->forge->dropColumn('calendar_events', 'no_school');
|
||||
} catch (\Throwable $e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user