Minor - format code, add "CREATE TABLE IF NOT EXISTS" see BT#14091

pull/2458/head
jmontoyaa 8 years ago
parent fe7fc1fe22
commit 54ea6f5833
  1. 14
      plugin/dictionary/DictionaryPlugin.php

@ -1,8 +1,14 @@
<?php <?php
/* For licensing terms, see /license.txt */ /* For licensing terms, see /license.txt */
/**
* Class DictionaryPlugin
*/
class DictionaryPlugin extends Plugin class DictionaryPlugin extends Plugin
{ {
/**
* DictionaryPlugin constructor.
*/
protected function __construct() protected function __construct()
{ {
parent::__construct( parent::__construct(
@ -23,9 +29,12 @@ class DictionaryPlugin extends Plugin
return $result ? $result : $result = new self(); return $result ? $result : $result = new self();
} }
/**
* @throws \Doctrine\DBAL\DBALException
*/
public function install() public function install()
{ {
$sql = "CREATE TABLE plugin_dictionary ( $sql = "CREATE TABLE IF NOT EXISTS plugin_dictionary (
id INT NOT NULL AUTO_INCREMENT, id INT NOT NULL AUTO_INCREMENT,
term VARCHAR(255) NOT NULL, term VARCHAR(255) NOT NULL,
definition LONGTEXT NOT NULL, definition LONGTEXT NOT NULL,
@ -34,6 +43,9 @@ class DictionaryPlugin extends Plugin
Database::query($sql); Database::query($sql);
} }
/**
* @throws \Doctrine\DBAL\DBALException
*/
public function uninstall() public function uninstall()
{ {
$sql = "DROP TABLE IF EXISTS plugin_dictionary"; $sql = "DROP TABLE IF EXISTS plugin_dictionary";

Loading…
Cancel
Save