How can I alter table or reset the auto-increment of a field in Yii 1.x, using CDbMigration
?
I found alterColumn
method, as good as createTable
, dropTable
, renameTable
and truncateTable
methods, but either I'm blind or there isn't anything for altering table or resetting the auto-increment of particular column or field.
You can use execute() as Yii defines it:
Executes a SQL statement. This method executes the specified SQL statement using dbConnection.
So,
$this->execute("ALTER TABLE tbl_name AUTO_INCREMENT = 1");