/** * @see QueryWriter::wipeAll */ public function wipeAll() { foreach ($this->getTables() as $t) { try { $foreignKeys = $this->adapter->getAssoc("SELECT\n\t\t\t\t 'ALTER TABLE ' + OBJECT_SCHEMA_NAME(parent_object_id) +\n\t\t\t\t '.[' + OBJECT_NAME(parent_object_id) +\n\t\t\t\t '] DROP CONSTRAINT ' + name\n\t\t\t\tFROM sys.foreign_keys\n\t\t\t\tWHERE referenced_object_id = object_id('{$t}')"); if (count($foreignKeys)) { foreach ($foreignKeys as $sql) { $this->adapter->exec($sql); } } $this->adapter->exec("IF OBJECT_ID('[{$t}]', 'U') IS NOT NULL DROP TABLE [{$t}];"); } catch (SQLException $e) { } } }