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