yii2-test-1/console/migrations/m230503_151354_create_text_table.php

34 lines
749 B
PHP
Raw Normal View History

2023-05-06 20:40:02 +03:00
<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%text}}`.
*/
class m230503_151354_create_text_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%text}}', [
'id' => $this->primaryKey(),
'profile_id' => $this->integer(),
'title' => $this->string(),
'text' => $this->text(),
'language' => $this->string()
]);
$this->addForeignKey('profile_foreign', 'text', 'profile_id', 'profile', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('profile_foreign', 'text');
$this->dropTable('{{%text}}');
}
}