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
This commit is contained in:
commit
73d46afc3c
2 changed files with 20 additions and 0 deletions
|
@ -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>
|
||||
|
|
|
@ -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':
|
||||
|
|
Loading…
Reference in a new issue