How to set datatype longtext in migrationscript

Hi guys, I use following code in order to get any desired values of attribute for bodytext. [Datatype sholud be longtext() or varchar() ] DBMS is MySQLActually, bodytext will be regimented to varchar(255). Why??


$this->createTable('mail_eingang', [            'id' => $this->primaryKey(),            'mail_adresse_absender' => $this->string(255)->notNull(),            'betreff' => $this->string(255),            'bodytext' => $this->string(), //this will actually set bodytext to varchar(255). It should be longtext() or varchar() !!            'gelesen' => $this->smallInteger(1)->notNull()->defaultValue(0),            'angelegt_am' => $this->datetime(),            'angelegt_von' => $this->integer(11),            'aktualisiert_am' => $this->datetime(),            'aktualisiert_von' => $this->integer(11),            'FOREIGN KEY ([[angelegt_von]]) REFERENCES person ([[id]]) ON DELETE SET NULL ON UPDATE RESTRICT',            'FOREIGN KEY ([[aktualisiert_von]]) REFERENCES person ([[id]]) ON DELETE SET NULL ON UPDATE RESTRICT',                ], $tableOptions);

You have to use


$this->text() 

to get a varchar field.

https://www.yiiframework.com/doc/guide/2.0/en/db-migrations

Thx for this!

This tread can be clodes as succesfully solved!