php-censor/src/Migrations/20171209135004_added_new_label_for_errors.php
2018-03-09 13:46:18 +07:00

45 lines
1.1 KiB
PHP

<?php
use Phinx\Migration\AbstractMigration;
class AddedNewLabelForErrors extends AbstractMigration
{
public function up()
{
if ($this->hasTable('build_error')) {
$table = $this->table('build_error');
if (!$table->hasColumn('hash')) {
$table
->addColumn('hash', 'string', ['limit' => 32, 'default' => ''])
->save();
}
if (!$table->hasColumn('is_new')) {
$table
->addColumn('is_new', 'boolean', ['default' => false])
->save();
}
}
}
public function down()
{
if ($this->hasTable('build_error')) {
$table = $this->table('build_error');
if ($table->hasColumn('hash')) {
$table
->removeColumn('hash')
->save();
}
if ($table->hasColumn('is_new')) {
$table
->removeColumn('is_new')
->save();
}
}
}
}