diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-18 11:18:32 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-18 11:18:32 +0100 |
commit | 73d46afc3c5ef237cc8a5431aa1bef4686a7521b (patch) | |
tree | b1fbcdf3e1556ade24e0a7fdcc051c1735f5bf3f | |
parent | bba8875fb5669dcf0d93033a63824e942a823622 (diff) | |
parent | b14e8fa427c2204570879104feee3e20670787ac (diff) | |
download | nextcloud-server-73d46afc3c5ef237cc8a5431aa1bef4686a7521b.tar.gz nextcloud-server-73d46afc3c5ef237cc8a5431aa1bef4686a7521b.zip |
Merge pull request #22399 from owncloud/issue-22394-index-names-for-oracle
Add index names so Doctrine does not use a too long random string
-rw-r--r-- | apps/files_external/appinfo/database.xml | 9 | ||||
-rw-r--r-- | lib/private/db/mdb2schemareader.php | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/apps/files_external/appinfo/database.xml b/apps/files_external/appinfo/database.xml index 2c3615a4d4c..54ee642ead6 100644 --- a/apps/files_external/appinfo/database.xml +++ b/apps/files_external/appinfo/database.xml @@ -79,13 +79,16 @@ <type>text</type> <length>64</length> </field> + <index> + <name>applicable_mount</name> <field> <name>mount_id</name> <sorting>ascending</sorting> </field> </index> <index> + <name>applicable_type_value</name> <field> <name>type</name> <sorting>ascending</sorting> @@ -96,6 +99,7 @@ </field> </index> <index> + <name>applicable_type_value_mount</name> <unique>true</unique> <field> <name>type</name> @@ -112,6 +116,7 @@ </index> </declaration> </table> + <table> <name>*dbprefix*external_config</name> <declaration> @@ -144,12 +149,14 @@ </field> <index> + <name>config_mount</name> <field> <name>mount_id</name> <sorting>ascending</sorting> </field> </index> <index> + <name>config_mount_key</name> <unique>true</unique> <field> <name>mount_id</name> @@ -162,6 +169,7 @@ </index> </declaration> </table> + <table> <name>*dbprefix*external_options</name> <declaration> @@ -194,6 +202,7 @@ </field> <index> + <name>option_mount</name> <field> <name>mount_id</name> <sorting>ascending</sorting> diff --git a/lib/private/db/mdb2schemareader.php b/lib/private/db/mdb2schemareader.php index 6f99206e5c8..94c48d61f06 100644 --- a/lib/private/db/mdb2schemareader.php +++ b/lib/private/db/mdb2schemareader.php @@ -30,6 +30,7 @@ namespace OC\DB; use Doctrine\DBAL\Platforms\AbstractPlatform; +use Doctrine\DBAL\Schema\SchemaConfig; use OCP\IConfig; class MDB2SchemaReader { @@ -48,6 +49,9 @@ class MDB2SchemaReader { */ protected $platform; + /** @var \Doctrine\DBAL\Schema\SchemaConfig $schemaConfig */ + protected $schemaConfig; + /** * @param \OCP\IConfig $config * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform @@ -56,6 +60,12 @@ class MDB2SchemaReader { $this->platform = $platform; $this->DBNAME = $config->getSystemValue('dbname', 'owncloud'); $this->DBTABLEPREFIX = $config->getSystemValue('dbtableprefix', 'oc_'); + + // Oracle does not support longer index names then 30 characters. + // We use this limit for all DBs to make sure it does not cause a + // problem. + $this->schemaConfig = new SchemaConfig(); + $this->schemaConfig->setMaxIdentifierLength(30); } /** @@ -107,6 +117,7 @@ class MDB2SchemaReader { $name = $this->platform->quoteIdentifier($name); $table = $schema->createTable($name); $table->addOption('collate', 'utf8_bin'); + $table->setSchemaConfig($this->schemaConfig); break; case 'create': case 'overwrite': |