From: Robin Appelman Date: Wed, 4 Mar 2015 14:05:30 +0000 (+0100) Subject: Rename platform X-Git-Tag: v8.1.0alpha1~160^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ac8254de6a4adc60733de1eec242893004bfcc5a;p=nextcloud-server.git Rename platform --- diff --git a/lib/private/db/connectionfactory.php b/lib/private/db/connectionfactory.php index c488bf82d1f..b86e7319ae7 100644 --- a/lib/private/db/connectionfactory.php +++ b/lib/private/db/connectionfactory.php @@ -96,7 +96,7 @@ class ConnectionFactory { break; case 'sqlite3': $journalMode = $additionalConnectionParams['sqlite.journal_mode']; - $additionalConnectionParams['platform'] = new SqlitePlatform(); + $additionalConnectionParams['platform'] = new OCSqlitePlatform(); $eventManager->addEventSubscriber(new SQLiteSessionInit(true, $journalMode)); break; } diff --git a/lib/private/db/ocsqliteplatform.php b/lib/private/db/ocsqliteplatform.php new file mode 100644 index 00000000000..fe39e20c864 --- /dev/null +++ b/lib/private/db/ocsqliteplatform.php @@ -0,0 +1,35 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OC\DB; + +class OCSqlitePlatform extends \Doctrine\DBAL\Platforms\SqlitePlatform { + /** + * {@inheritDoc} + */ + public function getColumnDeclarationSQL($name, array $field) { + $def = parent::getColumnDeclarationSQL($name, $field); + if (!empty($field['autoincrement'])) { + $def .= ' PRIMARY KEY AUTOINCREMENT'; + } + return $def; + } + + /** + * {@inheritDoc} + */ + protected function _getCreateTableSQL($name, array $columns, array $options = array()){ + // if auto increment is set the column is already defined as primary key + foreach ($columns as $column) { + if (!empty($column['autoincrement'])) { + $options['primary'] = null; + } + } + return parent::_getCreateTableSQL($name, $columns, $options); + } +} diff --git a/lib/private/db/sqliteplatform.php b/lib/private/db/sqliteplatform.php deleted file mode 100644 index b2eec7dd7bf..00000000000 --- a/lib/private/db/sqliteplatform.php +++ /dev/null @@ -1,35 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ - -namespace OC\DB; - -class SqlitePlatform extends \Doctrine\DBAL\Platforms\SqlitePlatform { - /** - * {@inheritDoc} - */ - public function getColumnDeclarationSQL($name, array $field) { - $def = parent::getColumnDeclarationSQL($name, $field); - if (!empty($field['autoincrement'])) { - $def .= ' PRIMARY KEY AUTOINCREMENT'; - } - return $def; - } - - /** - * {@inheritDoc} - */ - protected function _getCreateTableSQL($name, array $columns, array $options = array()){ - // if auto increment is set the column is already defined as primary key - foreach ($columns as $column) { - if (!empty($column['autoincrement'])) { - $options['primary'] = null; - } - } - return parent::_getCreateTableSQL($name, $columns, $options); - } -}