banki.test/migrations/m240819_102301_image.php

50 lines
1.0 KiB
PHP

<?php
use yii\db\mysql\Schema;
use yii\db\Migration;
/**
* Class m240819_102301_image
*/
class m240819_102301_image extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('image', [
'id' => Schema::TYPE_PK,
'sha256' => Schema::TYPE_STRING . ' NOT NULL',
'original_name' => Schema::TYPE_STRING . ' NOT NULL'
]);
$this->addColumn('parameters', 'icon_id', 'INT(11) DEFAULT NULL');
$this->addColumn('parameters', 'icon_gray_id', 'INT(11) DEFAULT NULL');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('image');
$this->dropColumn('parameters', 'icon_id');
$this->dropColumn('parameters', 'icon_gray_id');
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "m240819_102301_image cannot be reverted.\n";
return false;
}
*/
}