diff --git a/common/models/Customer.php b/common/models/Customer.php index db98b41..eb244b8 100644 --- a/common/models/Customer.php +++ b/common/models/Customer.php @@ -4,6 +4,8 @@ use Yii; use yii\helpers\FileHelper; + use yii\behaviors\TimestampBehavior; + /** * This is the model class for table "customer". @@ -47,6 +49,9 @@ * * @property integer $working_lang * @property string $post_address ==> официальный почтовый адрес + * + * @property integer $created_at + * */ class Customer extends \yii\db\ActiveRecord { @@ -75,8 +80,21 @@ { return 'customer'; } - - /** + + + + public function behaviors() + { + return [ + [ + 'class' => TimestampBehavior::className(), + 'updatedAtAttribute' => false, + ], + ]; + } + + + /** * {@inheritdoc} */ public function rules() diff --git a/console/migrations/m180912_090212_customer_add_update_at_column.php b/console/migrations/m180912_090212_customer_add_update_at_column.php new file mode 100644 index 0000000..0a4b924 --- /dev/null +++ b/console/migrations/m180912_090212_customer_add_update_at_column.php @@ -0,0 +1,22 @@ +addColumn('customer', + 'created_at', + $this->integer()); + } + + public function down() + { + $this->dropColumn('customer','created_at'); + } + +} -- libgit2 0.21.4