Yii2: Add ability to use \yii\db\Expression for SchemaBuilder::defaultValue()

Created on 6 Aug 2015  路  4Comments  路  Source: yiisoft/yii2

Add ability to use \yii\db\Expression for SchemaBuilder::defaultValue().
Particularly this need for assign default value to TIMESTAMP column:
$this->timestamp()->defaultValue(new \yii\db\Expression('CURRENT_TIMESTAMP'))

easy enhancement

Most helpful comment

Perhaps we should introduce another method defaultExpression() for expressions to simplify syntax:

$this->timestamp()->defaultExpression('CURRENT_TIMESTAMP')

All 4 comments

Perhaps we should introduce another method defaultExpression() for expressions to simplify syntax:

$this->timestamp()->defaultExpression('CURRENT_TIMESTAMP')

:+1:

+1

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chaintng picture chaintng  路  3Comments

AstRonin picture AstRonin  路  3Comments

sobit picture sobit  路  3Comments

indicalabs picture indicalabs  路  3Comments

MUTOgen picture MUTOgen  路  3Comments