diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-03-04 15:05:30 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-03-25 18:33:21 +0100 |
commit | ac8254de6a4adc60733de1eec242893004bfcc5a (patch) | |
tree | 26428f7a54099ea7404b1545d31a9fb0834d1015 /lib/private/db/ocsqliteplatform.php | |
parent | fc0c4990d53f00c9c06342b3de0a948e59baf201 (diff) | |
download | nextcloud-server-ac8254de6a4adc60733de1eec242893004bfcc5a.tar.gz nextcloud-server-ac8254de6a4adc60733de1eec242893004bfcc5a.zip |
Rename platform
Diffstat (limited to 'lib/private/db/ocsqliteplatform.php')
-rw-r--r-- | lib/private/db/ocsqliteplatform.php | 35 |
1 files changed, 35 insertions, 0 deletions
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 @@ +<?php +/** + * Copyright (c) 2015 Robin Appelman <icewind@owncloud.com> + * 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); + } +} |