---
title: "YII migrations and bu default values for table columns"  
description: "YII migrations and bu default values for table columns"  
author: "Royce Roy"  
published: 2013-05-15  
updated: 2013-05-15  
canonical: https://www.mindstick.com/forum/891/yii-migrations-and-bu-default-values-for-table-columns  
category: "php"  
tags: ["php"]  
reading_time: 1 minute  

---

# YII migrations and bu default values for table columns

Hi Everyone!\
public [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) up(){\
$this->createTable('POST', array( 'id' => 'pk', 'isremoved' => '[integer](https://answers.mindstick.com/qa/113667/write-code-for-roman-to-integer) [NOT NULL](https://www.mindstick.com/interview/1933/what-is-not-null-constraint)', 'removaldate' => '[timestamp](https://www.mindstick.com/interview/791/what-does-timestamp-on-update-current_timestamp-data-type-do) NULL', 'post' => 'text NOT NULL', 'creationdate' => 'timestamp NOT NULL', ));}\
This is the up function for migration. As u see it is query for creating new table. By default YII creates [default value](https://www.mindstick.com/forum/2035/default-value-when-using-singleordefault) for timestamp column equal to [CURRENT_TIMESTAMP](https://www.mindstick.com/interview/34507/difference-between-getdate-vs-current_timestamp) and crates additional [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) and sets it equal to ON [UPDATE](https://www.mindstick.com/forum/156353/what-is-hummingbird-update) CURRENT_TIMESTAMP.\
I do not need current value for timestamp and I do not need to update this column on updating row. What i must to do? By the way, u use MySQL\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)! \

## Replies

### Reply by AVADHESH PATEL

Hi Royce!\
You have to set other [default](https://www.mindstick.com/interview/12771/what-is-the-importance-of-default-resources) value, null for example\

```
public function up(){        $this->createTable('POST', array(            'id' => 'pk',            'isremoved' => 'integer NOT NULL',            'removaldate' => 'timestamp DEFAULT NULL',            'post' => 'text NOT NULL',            'creationdate' => 'timestamp DEFAULT NULL',        ));}
```

\
I hope it help to you.


---

Original Source: https://www.mindstick.com/forum/891/yii-migrations-and-bu-default-values-for-table-columns

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
