diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2016-02-15 15:02:15 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2016-02-16 09:28:29 +0100 |
commit | b14e8fa427c2204570879104feee3e20670787ac (patch) | |
tree | 95e0848fe167a186eede88fc0268973a0e9f20f8 /lib/private/db | |
parent | 7e4c3b577cb3442dfa948dcf37599761823e1059 (diff) | |
download | nextcloud-server-b14e8fa427c2204570879104feee3e20670787ac.tar.gz nextcloud-server-b14e8fa427c2204570879104feee3e20670787ac.zip |
Make sure our index names fit in oracle
Diffstat (limited to 'lib/private/db')
-rw-r--r-- | lib/private/db/mdb2schemareader.php | 11 |
1 files changed, 11 insertions, 0 deletions
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': |