Example #1
0
 /**
  * @param $model \Mindy\Orm\Model
  */
 public function dropIndexes(Model $model)
 {
     $command = $this->db->createCommand();
     try {
         // checkIntegrity is not supported by SQLite
         // $command->checkIntegrity(false)->execute();
     } catch (NotSupportedException $e) {
     }
     foreach ($model->getFields() as $name => $field) {
         if (is_a($field, '\\Mindy\\Orm\\Fields\\ForeignField')) {
             /* @var $modelClass Orm */
             /* @var $field \Mindy\Orm\Fields\ForeignField */
             // $modelClass = $field->relation->modelClass;
             $command->dropForeignKey("fk_{$name}", $model::tableName());
         }
     }
     try {
         // checkIntegrity is not supported by SQLite
         // $command->checkIntegrity(true)->execute();
     } catch (NotSupportedException $e) {
     }
 }