diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-17 13:47:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-17 13:47:58 +0100 |
commit | 24c58d39f4238f1068c629937a1a2baa37214068 (patch) | |
tree | 30ef2e5f6f5f8930bdb7dc8d76885307307d5332 /lib/private/DB | |
parent | f8756d96bc7821a1082dd19cb8aea6d0b933505a (diff) | |
parent | 4a5282ba2191059a356540165ac43dcb972eda8d (diff) | |
download | nextcloud-server-24c58d39f4238f1068c629937a1a2baa37214068.tar.gz nextcloud-server-24c58d39f4238f1068c629937a1a2baa37214068.zip |
Merge pull request #7909 from nextcloud/fix-migration-type-hints
Fix the type hints of migrations and correctly inject the wrapped sch…
Diffstat (limited to 'lib/private/DB')
-rw-r--r-- | lib/private/DB/MigrationService.php | 4 | ||||
-rw-r--r-- | lib/private/DB/SchemaWrapper.php | 33 |
2 files changed, 16 insertions, 21 deletions
diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index 0c881f28ecb..89a8d42f08a 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -423,7 +423,7 @@ class MigrationService { } $instance->preSchemaChange($this->output, function() { - return $this->connection->createSchema(); + return new SchemaWrapper($this->connection); }, ['tablePrefix' => $this->connection->getPrefix()]); $toSchema = $instance->changeSchema($this->output, function() { @@ -436,7 +436,7 @@ class MigrationService { } $instance->postSchemaChange($this->output, function() { - return $this->connection->createSchema(); + return new SchemaWrapper($this->connection); }, ['tablePrefix' => $this->connection->getPrefix()]); $this->markAsExecuted($version); diff --git a/lib/private/DB/SchemaWrapper.php b/lib/private/DB/SchemaWrapper.php index 2a0660b2a88..4f05b7b00ef 100644 --- a/lib/private/DB/SchemaWrapper.php +++ b/lib/private/DB/SchemaWrapper.php @@ -25,9 +25,10 @@ namespace OC\DB; use Doctrine\DBAL\DBALException; use Doctrine\DBAL\Schema\Schema; +use OCP\DB\ISchemaWrapper; use OCP\IDBConnection; -class SchemaWrapper { +class SchemaWrapper implements ISchemaWrapper { /** @var IDBConnection|Connection */ protected $connection; @@ -76,6 +77,13 @@ class SchemaWrapper { // Overwritten methods /** + * @return array + */ + public function getTableNames() { + return $this->schema->getTableNames(); + } + + /** * @param string $tableName * * @return \Doctrine\DBAL\Schema\Table @@ -107,19 +115,6 @@ class SchemaWrapper { } /** - * Renames a table. - * - * @param string $oldTableName - * @param string $newTableName - * - * @return \Doctrine\DBAL\Schema\Schema - * @throws DBALException - */ - public function renameTable($oldTableName, $newTableName) { - throw new DBALException('Renaming tables is not supported. Please create and drop the tables manually.'); - } - - /** * Drops a table from the schema. * * @param string $tableName @@ -131,11 +126,11 @@ class SchemaWrapper { } /** - * @param string $name - * @param array $arguments - * @return mixed + * Gets all tables of this schema. + * + * @return \Doctrine\DBAL\Schema\Table[] */ - public function __call($name, $arguments) { - return call_user_func_array([$this->schema, $name], $arguments); + public function getTables() { + return $this->schema->getTables(); } } |