Specifying an unsigned attribute when using the line pattern icon in MIgrations?

I need to specify the column as unsigned in yii2 transitions.
Example migration code from the manual

public function up()
{
    $this->createTable('news', [
        'id' => $this->primaryKey(),
        'title' => $this->string()->notNull()
    ]);
}

From the research I did, there seems to be no way to add unsigned capabilities to a schema builder property.

But is there another way to add an unsigned attribute to a column while still using the schemaBuilderTrait style methods?

For example, the $this->string()above returns an instance yii\db\ColumnSchemaBuilder, but it does not even have a property to set unsigned / signed ..

+4
source share
2 answers

Unfortunately, some things cannot be written using the new migration syntax.

:

'title' => $this->string()->notNull() . ' UNSIGNED',

( ):

use yii\db\Schema;

...

'title' => Schema::TYPE_STRING . ' NOT NULL UNSIGNED',

P.S. .

:. , ->unsigned(). , . leitasat .

+6

: .

->unsigned() .

+2

All Articles