/** * @param $model \Mindy\Orm\Model */ public function dropTable(Model $model) { $command = $this->db->createCommand(); try { // checkIntegrity is not supported by SQLite // $command->checkIntegrity(false)->execute(); } catch (NotSupportedException $e) { } foreach ($model->getManyFields() as $field) { if ($field->through === null) { if ($this->hasTable($model, $field->getTableName())) { $command->dropTable($field->getTableName())->execute(); } } } $command->dropTable($model->tableName())->execute(); try { // checkIntegrity is not supported by SQLite // $this->db->createCommand()->checkIntegrity(true)->execute(); } catch (NotSupportedException $e) { } }