guild/console/migrations/m230419_223851_create_project_column_table.php

36 lines
929 B
PHP
Raw Normal View History

2023-04-20 02:07:19 +03:00
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%project_column}}`.
*/
class m230419_223851_create_project_column_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%project_column}}', [
'id' => $this->primaryKey(),
'title' => $this->string(255)->notNull(),
'project_id' => $this->integer()->notNull(),
'created_at' => $this->dateTime(),
'updated_at' => $this->dateTime(),
'status' => $this->integer(1)->defaultValue(1)
]);
$this->addForeignKey('fk_project_column_project', 'project_column', 'project_id', 'project', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('fk_project_column_project', 'project_column');
$this->dropTable('{{%project_column}}');
}
}