diff --git a/cake/libs/model/datasources/dbo/dbo_sqlite.php b/cake/libs/model/datasources/dbo/dbo_sqlite.php index 33248048b87..b7a30e6b54d 100644 --- a/cake/libs/model/datasources/dbo/dbo_sqlite.php +++ b/cake/libs/model/datasources/dbo/dbo_sqlite.php @@ -528,4 +528,22 @@ function renderStatement($type, $data) { function hasResult() { return is_object($this->_result); } + +/** + * Generate a "drop table" statement for the given Schema object + * + * @param object $schema An instance of a subclass of CakeSchema + * @param string $table Optional. If specified only the table name given will be generated. + * Otherwise, all tables defined in the schema are generated. + * @return string + */ + public function dropSchema(CakeSchema $schema, $table = null) { + $out = ''; + foreach ($schema->tables as $curTable => $columns) { + if (!$table || $table == $curTable) { + $out .= 'DROP TABLE IF EXISTS ' . $this->fullTableName($curTable) . ";\n"; + } + } + return $out; + } } \ No newline at end of file