<?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}}');
    }
}
