43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Database\Migrations;
|
|
|
|
use CodeIgniter\Database\Migration;
|
|
|
|
class AddHideJobOpeningsPopupToPreferences extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
if (! $this->db->tableExists('user_preferences')) {
|
|
return;
|
|
}
|
|
|
|
if (! $this->db->fieldExists('hide_job_openings_popup', 'user_preferences')) {
|
|
$definition = [
|
|
'type' => 'TINYINT',
|
|
'constraint' => 1,
|
|
'default' => 0,
|
|
'null' => false,
|
|
];
|
|
|
|
if ($this->db->fieldExists('menu_custom_mode', 'user_preferences')) {
|
|
$definition['after'] = 'menu_custom_mode';
|
|
}
|
|
|
|
$this->forge->addColumn('user_preferences', [
|
|
'hide_job_openings_popup' => $definition,
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
if (
|
|
$this->db->tableExists('user_preferences')
|
|
&& $this->db->fieldExists('hide_job_openings_popup', 'user_preferences')
|
|
) {
|
|
$this->forge->dropColumn('user_preferences', 'hide_job_openings_popup');
|
|
}
|
|
}
|
|
}
|