Blame view

sources/lib/private/db/oraclemigrator.php 1.05 KB
6d9380f96   Cédric Dupont   Update sources OC...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  <?php
  /**
   * Copyright (c) 2014 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;
  
  use Doctrine\DBAL\Schema\Schema;
  
  class OracleMigrator extends NoCheckMigrator {
  	/**
  	 * @param Schema $targetSchema
  	 * @param \Doctrine\DBAL\Connection $connection
  	 * @return \Doctrine\DBAL\Schema\SchemaDiff
  	 */
  	protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
  		$schemaDiff = parent::getDiff($targetSchema, $connection);
  
  		// oracle forces us to quote the identifiers
  		foreach ($schemaDiff->changedTables as $tableDiff) {
  			$tableDiff->name = $this->connection->quoteIdentifier($tableDiff->name);
  			foreach ($tableDiff->changedColumns as $column) {
  				$column->oldColumnName = $this->connection->quoteIdentifier($column->oldColumnName);
  			}
  		}
  
  		return $schemaDiff;
  	}
  
  	/**
  	 * @param string $name
  	 * @return string
  	 */
  	protected function generateTemporaryTableName($name) {
  		return 'oc_' . uniqid();
  	}
  }