RainLab\Builder\Classes\TableMigrationCodeGenerator::dropTable PHP Метод

dropTable() публичный Метод

Generates code for dropping a database table.
public dropTable ( Doctrine\DBAL\Schema\Table $existingTable ) : string
$existingTable Doctrine\DBAL\Schema\Table Specifies the existing table schema.
Результат string Returns the migration up() and down() methods code.
    public function dropTable($existingTable)
    {
        return $this->generateMigrationCode($this->generateDropUpCode($existingTable), $this->generateDropDownCode($existingTable));
    }

Usage Example

 public function generateDropMigration()
 {
     $existingSchema = $this->tableInfo;
     $codeGenerator = new TableMigrationCodeGenerator();
     $migrationCode = $codeGenerator->dropTable($existingSchema);
     return $this->createMigrationObject($migrationCode, sprintf('Drop table %s', $this->name));
 }