From 8f95fe1b8b9f06f721de6c08aa58d81fff4ae9ba Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Wed, 18 Sep 2013 08:25:20 +0200 Subject: [PATCH] remove all tables before inserting tables creation --- core/lib/Thelia/Command/ReloadDatabaseCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/lib/Thelia/Command/ReloadDatabaseCommand.php b/core/lib/Thelia/Command/ReloadDatabaseCommand.php index 70fab56d9..311b20552 100644 --- a/core/lib/Thelia/Command/ReloadDatabaseCommand.php +++ b/core/lib/Thelia/Command/ReloadDatabaseCommand.php @@ -54,6 +54,13 @@ class ReloadDatabaseCommand extends BaseModuleGenerate $connection = Propel::getConnection(\Thelia\Model\Map\ProductTableMap::DATABASE_NAME); $connection = $connection->getWrappedConnection(); + $tables = $connection->query("SHOW TABLES"); + $connection->query("SET FOREIGN_KEY_CHECKS = 0"); + foreach($tables as $table) { + $connection->query(sprintf("DROP TABLE `%s`", $table[0])); + } + $connection->query("SET FOREIGN_KEY_CHECKS = 1"); + $database = new Database($connection); $output->writeln(array( '',