diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2019-09-11 10:43:42 +0300 |
---|---|---|
committer | diosmosis <diosmosis@users.noreply.github.com> | 2019-09-11 10:43:42 +0300 |
commit | 7b140a9f557e24384f5498741a372b5d1bbdc181 (patch) | |
tree | fd03fd5914ad4b5b7d29fa0d0b46f27c7e16d5cc | |
parent | e31ec88c07621cf52283490e5ffc7935308d00d5 (diff) |
Use "if not exists" when trying to create table (#14886)
This can avoid some error logs depending on the used database adapter etc. In theory we can then remove catching the error a few lines below but should be fine to keep it as well
-rw-r--r-- | core/Db/Schema/Mysql.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/Db/Schema/Mysql.php b/core/Db/Schema/Mysql.php index 3f7ac6e767..b121f72edb 100644 --- a/core/Db/Schema/Mysql.php +++ b/core/Db/Schema/Mysql.php @@ -450,7 +450,7 @@ class Mysql implements SchemaInterface */ public function createTable($nameWithoutPrefix, $createDefinition) { - $statement = sprintf("CREATE TABLE `%s` ( %s ) ENGINE=%s DEFAULT CHARSET=utf8 ;", + $statement = sprintf("CREATE TABLE IF NOT EXISTS `%s` ( %s ) ENGINE=%s DEFAULT CHARSET=utf8 ;", Common::prefixTable($nameWithoutPrefix), $createDefinition, $this->getTableEngine()); |