pra*_*tom 4 database-migration yii
我有一个使用yii开发的现有Web应用程序数据库.现在表中的一个属性是int类型,但我想将其类型转换为表中的时间戳.如何使用yii迁移实现此目的,以便我的Web应用程序受到影响.我正在使用Mysql数据库.
小智 10
创建yii迁移并修改代码
public function up(){
$this->alterColumn('table_name', 'column_name', 'new_data_type');//timestamp new_data_type
}
public function down() {
$this->alterColumn('table_name','column_name', 'old_data_type' );//int is old_data_type
}
Run Code Online (Sandbox Code Playgroud)
然后向上迁移
| 归档时间: |
|
| 查看次数: |
5920 次 |
| 最近记录: |