Merge pull request #7915 from nextcloud/backport/7909/fix-migration-type-hints
Fix the type hints of migrations and correctly inject the wrapped sch…
This commit is contained in:
commit
414d6e2184
|
@ -23,20 +23,20 @@
|
|||
*/
|
||||
namespace OCA\DAV\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
class Version1004Date20170825134824 extends SimpleMigrationStep {
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if (!$schema->hasTable('addressbooks')) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
namespace OCA\DAV\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
|
@ -31,13 +31,13 @@ class Version1004Date20170919104507 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$table = $schema->getTable('addressbooks');
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
namespace OCA\DAV\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
|
@ -30,13 +30,13 @@ class Version1004Date20170924124212 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$table = $schema->getTable('cards');
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
*/
|
||||
namespace OCA\DAV\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\Migration\BigIntMigration;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
/**
|
||||
* Auto-generated migration step: Please modify to your needs!
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace OCA\TwoFactorBackupCodes\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
@ -31,13 +31,13 @@ use OCP\Migration\IOutput;
|
|||
class Version1002Date20170607104347 extends SimpleMigrationStep {
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if (!$schema->hasTable('twofactor_backupcodes')) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace OCA\TwoFactorBackupCodes\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
|
@ -43,12 +43,12 @@ class Version1002Date20170607113030 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if (!$schema->hasTable('twofactor_backup_codes')) {
|
||||
|
@ -87,13 +87,13 @@ class Version1002Date20170607113030 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if ($schema->hasTable('twofactor_backup_codes')) {
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace OCA\TwoFactorBackupCodes\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
|
@ -32,13 +32,13 @@ class Version1002Date20170919123342 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$table = $schema->getTable('twofactor_backupcodes');
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
<?php
|
||||
namespace OCA\TwoFactorBackupCodes\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\Migration\BigIntMigration;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
/**
|
||||
* Auto-generated migration step: Please modify to your needs!
|
||||
|
|
|
@ -39,7 +39,7 @@ class GenerateCommand extends Command {
|
|||
'<?php
|
||||
namespace {{namespace}};
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
|
@ -50,7 +50,7 @@ class {{classname}} extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
@ -59,9 +59,9 @@ class {{classname}} extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
|
@ -70,7 +70,7 @@ class {{classname}} extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
|
|
@ -91,7 +91,7 @@ class GenerateFromSchemaFileCommand extends GenerateCommand {
|
|||
*/
|
||||
protected function schemaToMigration(Schema $schema) {
|
||||
$content = <<<'EOT'
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
EOT;
|
||||
|
|
|
@ -23,21 +23,21 @@
|
|||
|
||||
namespace OC\Core\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
class Version13000Date20170705121758 extends SimpleMigrationStep {
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if (!$schema->hasTable('personal_sections')) {
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace OC\Core\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
|
@ -32,13 +32,13 @@ class Version13000Date20170718121200 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
if (!$schema->hasTable('appconfig')) {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace OC\Core\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
|
@ -31,7 +31,7 @@ class Version13000Date20170814074715 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
@ -40,13 +40,13 @@ class Version13000Date20170814074715 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
|
||||
|
@ -69,7 +69,7 @@ class Version13000Date20170814074715 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
*/
|
||||
namespace OC\Core\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
|
@ -34,7 +34,7 @@ class Version13000Date20170919121250 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
@ -43,13 +43,13 @@ class Version13000Date20170919121250 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$table = $schema->getTable('jobs');
|
||||
|
@ -115,7 +115,7 @@ class Version13000Date20170919121250 extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
|
|
@ -23,10 +23,7 @@
|
|||
*/
|
||||
namespace OC\Core\Migrations;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\Migration\BigIntMigration;
|
||||
use OCP\Migration\SimpleMigrationStep;
|
||||
use OCP\Migration\IOutput;
|
||||
|
||||
/**
|
||||
* Auto-generated migration step: Please modify to your needs!
|
||||
|
|
|
@ -99,6 +99,7 @@ return array(
|
|||
'OCP\\Contacts\\ContactsMenu\\IProvider' => $baseDir . '/lib/public/Contacts/ContactsMenu/IProvider.php',
|
||||
'OCP\\Contacts\\IManager' => $baseDir . '/lib/public/Contacts/IManager.php',
|
||||
'OCP\\DB' => $baseDir . '/lib/public/DB.php',
|
||||
'OCP\\DB\\ISchemaWrapper' => $baseDir . '/lib/public/DB/ISchemaWrapper.php',
|
||||
'OCP\\DB\\QueryBuilder\\ICompositeExpression' => $baseDir . '/lib/public/DB/QueryBuilder/ICompositeExpression.php',
|
||||
'OCP\\DB\\QueryBuilder\\IExpressionBuilder' => $baseDir . '/lib/public/DB/QueryBuilder/IExpressionBuilder.php',
|
||||
'OCP\\DB\\QueryBuilder\\IFunctionBuilder' => $baseDir . '/lib/public/DB/QueryBuilder/IFunctionBuilder.php',
|
||||
|
|
|
@ -123,6 +123,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
|
|||
'OCP\\Contacts\\ContactsMenu\\IProvider' => __DIR__ . '/../../..' . '/lib/public/Contacts/ContactsMenu/IProvider.php',
|
||||
'OCP\\Contacts\\IManager' => __DIR__ . '/../../..' . '/lib/public/Contacts/IManager.php',
|
||||
'OCP\\DB' => __DIR__ . '/../../..' . '/lib/public/DB.php',
|
||||
'OCP\\DB\\ISchemaWrapper' => __DIR__ . '/../../..' . '/lib/public/DB/ISchemaWrapper.php',
|
||||
'OCP\\DB\\QueryBuilder\\ICompositeExpression' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/ICompositeExpression.php',
|
||||
'OCP\\DB\\QueryBuilder\\IExpressionBuilder' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/IExpressionBuilder.php',
|
||||
'OCP\\DB\\QueryBuilder\\IFunctionBuilder' => __DIR__ . '/../../..' . '/lib/public/DB/QueryBuilder/IFunctionBuilder.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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -75,6 +76,13 @@ class SchemaWrapper {
|
|||
|
||||
// Overwritten methods
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getTableNames() {
|
||||
return $this->schema->getTableNames();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $tableName
|
||||
*
|
||||
|
@ -106,19 +114,6 @@ class SchemaWrapper {
|
|||
return $this->schema->createTable($this->connection->getPrefix() . $tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCP\DB;
|
||||
|
||||
/**
|
||||
* Interface ISchemaWrapper
|
||||
*
|
||||
* @package OCP\DB
|
||||
* @since 13.0.0
|
||||
*/
|
||||
interface ISchemaWrapper {
|
||||
|
||||
/**
|
||||
* @param string $tableName
|
||||
*
|
||||
* @return \Doctrine\DBAL\Schema\Table
|
||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function getTable($tableName);
|
||||
|
||||
/**
|
||||
* Does this schema have a table with the given name?
|
||||
*
|
||||
* @param string $tableName Prefix is automatically prepended
|
||||
*
|
||||
* @return boolean
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function hasTable($tableName);
|
||||
|
||||
/**
|
||||
* Creates a new table.
|
||||
*
|
||||
* @param string $tableName Prefix is automatically prepended
|
||||
* @return \Doctrine\DBAL\Schema\Table
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function createTable($tableName);
|
||||
|
||||
/**
|
||||
* Drops a table from the schema.
|
||||
*
|
||||
* @param string $tableName Prefix is automatically prepended
|
||||
* @return \Doctrine\DBAL\Schema\Schema
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function dropTable($tableName);
|
||||
|
||||
/**
|
||||
* Gets all tables of this schema.
|
||||
*
|
||||
* @return \Doctrine\DBAL\Schema\Table[]
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function getTables();
|
||||
|
||||
/**
|
||||
* Gets all table names, prefixed with table prefix
|
||||
*
|
||||
* @return array
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function getTableNames();
|
||||
|
||||
/**
|
||||
* Gets all table names
|
||||
*
|
||||
* @return array
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function getTableNamesWithoutPrefix();
|
||||
}
|
|
@ -23,8 +23,8 @@
|
|||
|
||||
namespace OCP\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use Doctrine\DBAL\Types\Type;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
|
||||
/**
|
||||
* @since 13.0.0
|
||||
|
@ -40,13 +40,13 @@ abstract class BigIntMigration extends SimpleMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
/** @var Schema $schema */
|
||||
/** @var ISchemaWrapper $schema */
|
||||
$schema = $schemaClosure();
|
||||
|
||||
$tables = $this->getColumnsByTable();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace OCP\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
|
||||
/**
|
||||
* @since 13.0.0
|
||||
|
@ -32,7 +32,7 @@ interface IMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
@ -40,16 +40,16 @@ interface IMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options);
|
||||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace OCP\Migration;
|
||||
|
||||
use Doctrine\DBAL\Schema\Schema;
|
||||
use OCP\DB\ISchemaWrapper;
|
||||
|
||||
/**
|
||||
* @since 13.0.0
|
||||
|
@ -32,7 +32,7 @@ abstract class SimpleMigrationStep implements IMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
@ -41,9 +41,9 @@ abstract class SimpleMigrationStep implements IMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @return null|Schema
|
||||
* @return null|ISchemaWrapper
|
||||
* @since 13.0.0
|
||||
*/
|
||||
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
|
||||
|
@ -52,7 +52,7 @@ abstract class SimpleMigrationStep implements IMigrationStep {
|
|||
|
||||
/**
|
||||
* @param IOutput $output
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `Schema`
|
||||
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
||||
* @param array $options
|
||||
* @since 13.0.0
|
||||
*/
|
||||
|
|
|
@ -16,8 +16,6 @@ use OC\DB\MigrationService;
|
|||
use OC\DB\SchemaWrapper;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\Migration\IMigrationStep;
|
||||
use OCP\Migration\ISchemaMigration;
|
||||
use OCP\Migration\ISqlMigration;
|
||||
|
||||
/**
|
||||
* Class MigrationsTest
|
||||
|
|
Loading…
Reference in New Issue