diff --git a/lib/Cake/Database/Schema/SqliteSchema.php b/lib/Cake/Database/Schema/SqliteSchema.php index b9a8920a41d..62fa6b5caba 100644 --- a/lib/Cake/Database/Schema/SqliteSchema.php +++ b/lib/Cake/Database/Schema/SqliteSchema.php @@ -270,4 +270,15 @@ public function createTableSql($table, $columns, $constraints, $indexes) { } return $out; } + +/** + * Generate the SQL to drop a table. + * + * @param Cake\Database\Schema\Table $table Table instance + * @return string DROP TABLE sql + */ + public function dropTableSql(Table $table) { + return sprintf('DROP TABLE "%s"', $table->name()); + } + } diff --git a/lib/Cake/Test/TestCase/Database/Schema/SqliteSchemaTest.php b/lib/Cake/Test/TestCase/Database/Schema/SqliteSchemaTest.php index 37d05547632..6191b916631 100644 --- a/lib/Cake/Test/TestCase/Database/Schema/SqliteSchemaTest.php +++ b/lib/Cake/Test/TestCase/Database/Schema/SqliteSchemaTest.php @@ -521,6 +521,23 @@ public function testCreateTableSql() { ); } + +/** + * test dropTableSql + * + * @return void + */ + public function testDropTableSql() { + $driver = $this->_getMockedDriver(); + $connection = $this->getMock('Cake\Database\Connection', array(), array(), '', false); + $connection->expects($this->any())->method('driver') + ->will($this->returnValue($driver)); + + $table = new Table('articles'); + $result = $table->dropTableSql($connection); + $this->assertEquals('DROP TABLE "articles"', $result); + } + /** * Get a schema instance with a mocked driver/pdo instances *