oraclemigrator.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. namespace OC\DB;
  9. use Doctrine\DBAL\Schema\Schema;
  10. class OracleMigrator extends NoCheckMigrator {
  11. /**
  12. * @param Schema $targetSchema
  13. * @param \Doctrine\DBAL\Connection $connection
  14. * @return \Doctrine\DBAL\Schema\SchemaDiff
  15. */
  16. protected function getDiff(Schema $targetSchema, \Doctrine\DBAL\Connection $connection) {
  17. $schemaDiff = parent::getDiff($targetSchema, $connection);
  18. // oracle forces us to quote the identifiers
  19. foreach ($schemaDiff->changedTables as $tableDiff) {
  20. $tableDiff->name = $this->connection->quoteIdentifier($tableDiff->name);
  21. foreach ($tableDiff->changedColumns as $column) {
  22. $column->oldColumnName = $this->connection->quoteIdentifier($column->oldColumnName);
  23. }
  24. }
  25. return $schemaDiff;
  26. }
  27. /**
  28. * @param string $name
  29. * @return string
  30. */
  31. protected function generateTemporaryTableName($name) {
  32. return 'oc_' . uniqid();
  33. }
  34. }