45 lines
945 B
PHP
Executable File
45 lines
945 B
PHP
Executable File
<?php
|
|
|
|
use yii\db\Migration;
|
|
|
|
/**
|
|
* Handles the creation of table `company`.
|
|
*/
|
|
class m181011_140628_create_company_table extends Migration
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function safeUp()
|
|
{
|
|
$this->createTable('company', [
|
|
'id' => $this->primaryKey(),
|
|
'name' => $this->string()->notNull(),
|
|
'description' => $this->text(),
|
|
'status_id' => $this->integer(),
|
|
'created_at' => $this->dateTime(),
|
|
'updated_at' => $this->dateTime(),
|
|
]);
|
|
|
|
$this->addForeignKey(
|
|
'company_ibfk_status',
|
|
'company',
|
|
'status_id',
|
|
'status',
|
|
'id',
|
|
'RESTRICT',
|
|
'CASCADE'
|
|
);
|
|
}
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function safeDown()
|
|
{
|
|
$this->dropForeignKey('company_ibfk_status', 'company');
|
|
|
|
$this->dropTable('company');
|
|
}
|
|
}
|