protected function drop() { $restore = $this->getRestoreFileName(); if (Sabel_Db_Migration_Manager::isUpgrade()) { if (is_file($restore)) { unlink($restore); } $schema = $this->getSchema()->getTable($this->tblName); $writer = new Sabel_Db_Migration_Writer($restore); $writer->writeTable($schema); $this->executeQuery("DROP TABLE " . $this->quoteIdentifier($this->tblName)); } else { $this->createTable($restore); } }
protected function drop() { $restore = $this->getRestoreFileName(); if (Sabel_Db_Migration_Manager::isUpgrade()) { if (is_file($restore)) { unlink($restore); } $schema = $this->getSchema()->getTable(convert_to_tablename($this->mdlName)); $writer = new Sabel_Db_Migration_Writer($restore); $writer->writeTable($schema); $tblName = $this->quoteIdentifier($schema->getTableName()); $this->executeQuery("DROP TABLE {$tblName}"); $this->dropSequence($schema->getSequenceColumn()); } else { $this->createTable($restore); } }
public function drop() { if (Sabel_Db_Migration_Manager::isUpgrade()) { $restore = $this->getRestoreFileName(); if (is_file($restore)) { unlink($restore); } $schema = $this->getSchema(); $tblSchema = $schema->getTable($this->tblName); $engine = $schema->getTableEngine($this->tblName); $writer = new Sabel_Db_Migration_Writer($restore); $writer->writeTable($tblSchema); $writer->write('$create->options("engine", "' . $engine . '");'); $writer->write(PHP_EOL)->close(); $this->executeQuery("DROP TABLE " . $this->quoteIdentifier($this->tblName)); } else { $this->createTable($this->getRestoreFileName()); } }