44 lines
907 B
PHP
44 lines
907 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Database\Migrations;
|
||
|
|
|
||
|
|
use CodeIgniter\Database\Migration;
|
||
|
|
|
||
|
|
class AddLabelDescriptionToFigmaVersions extends Migration
|
||
|
|
{
|
||
|
|
public function up()
|
||
|
|
{
|
||
|
|
$fields = [];
|
||
|
|
|
||
|
|
if (!$this->db->fieldExists('label', 'figma_file_versions')) {
|
||
|
|
$fields['label'] = [
|
||
|
|
'type' => 'VARCHAR',
|
||
|
|
'constraint' => 255,
|
||
|
|
'null' => true,
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!$this->db->fieldExists('description', 'figma_file_versions')) {
|
||
|
|
$fields['description'] = [
|
||
|
|
'type' => 'LONGTEXT',
|
||
|
|
'null' => true,
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
if (!empty($fields)) {
|
||
|
|
$this->forge->addColumn('figma_file_versions', $fields);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down()
|
||
|
|
{
|
||
|
|
if ($this->db->fieldExists('description', 'figma_file_versions')) {
|
||
|
|
$this->forge->dropColumn('figma_file_versions', 'description');
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($this->db->fieldExists('label', 'figma_file_versions')) {
|
||
|
|
$this->forge->dropColumn('figma_file_versions', 'label');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|