public function uninstall() { foreach (CustomPage::model()->findAll() as $entry) { $entry->delete(); } Yii::app()->db->createCommand()->dropTable(CustomPage::model()->tableName()); return parent::uninstall(); }