guild/console/migrations/m220110_205045_create_accompanying_document_table.php

32 lines
818 B
PHP
Raw Normal View History

<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%accompanying_document}}`.
*/
class m220110_205045_create_accompanying_document_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%accompanying_document}}', [
'id' => $this->primaryKey(),
2022-01-11 12:06:01 +03:00
'document_id' => $this->integer(11),
'title' => $this->string()->notNull(),
]);
2022-01-11 12:06:01 +03:00
$this->addForeignKey('document_accompanying_document', 'accompanying_document', 'document_id', 'document', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
2022-01-11 12:06:01 +03:00
$this->dropForeignKey('document_accompanying_document', 'accompanying_document');
$this->dropTable('{{%accompanying_document}}');
}
}