Pick a shorter name for the transfer ownership table
Signed-off-by: Joas Schilling <coding@schilljs.com> Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
b78a141b0b
commit
059968e1c7
|
@ -45,7 +45,7 @@ return array(
|
||||||
'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php',
|
'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php',
|
||||||
'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
|
'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
|
||||||
'OCA\\Files\\Listener\\LoadSidebarListener' => $baseDir . '/../lib/Listener/LoadSidebarListener.php',
|
'OCA\\Files\\Listener\\LoadSidebarListener' => $baseDir . '/../lib/Listener/LoadSidebarListener.php',
|
||||||
'OCA\\Files\\Migration\\Version11301Date20191113195931' => $baseDir . '/../lib/Migration/Version11301Date20191113195931.php',
|
'OCA\\Files\\Migration\\Version11301Date20191205150729' => $baseDir . '/../lib/Migration/Version11301Date20191205150729.php',
|
||||||
'OCA\\Files\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
|
'OCA\\Files\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',
|
||||||
'OCA\\Files\\Service\\DirectEditingService' => $baseDir . '/../lib/Service/DirectEditingService.php',
|
'OCA\\Files\\Service\\DirectEditingService' => $baseDir . '/../lib/Service/DirectEditingService.php',
|
||||||
'OCA\\Files\\Service\\OwnershipTransferService' => $baseDir . '/../lib/Service/OwnershipTransferService.php',
|
'OCA\\Files\\Service\\OwnershipTransferService' => $baseDir . '/../lib/Service/OwnershipTransferService.php',
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ComposerStaticInitFiles
|
||||||
'OCA\\Files\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
|
'OCA\\Files\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php',
|
||||||
'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__ . '/..' . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
|
'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__ . '/..' . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php',
|
||||||
'OCA\\Files\\Listener\\LoadSidebarListener' => __DIR__ . '/..' . '/../lib/Listener/LoadSidebarListener.php',
|
'OCA\\Files\\Listener\\LoadSidebarListener' => __DIR__ . '/..' . '/../lib/Listener/LoadSidebarListener.php',
|
||||||
'OCA\\Files\\Migration\\Version11301Date20191113195931' => __DIR__ . '/..' . '/../lib/Migration/Version11301Date20191113195931.php',
|
'OCA\\Files\\Migration\\Version11301Date20191205150729' => __DIR__ . '/..' . '/../lib/Migration/Version11301Date20191205150729.php',
|
||||||
'OCA\\Files\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
|
'OCA\\Files\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
|
||||||
'OCA\\Files\\Service\\DirectEditingService' => __DIR__ . '/..' . '/../lib/Service/DirectEditingService.php',
|
'OCA\\Files\\Service\\DirectEditingService' => __DIR__ . '/..' . '/../lib/Service/DirectEditingService.php',
|
||||||
'OCA\\Files\\Service\\OwnershipTransferService' => __DIR__ . '/..' . '/../lib/Service/OwnershipTransferService.php',
|
'OCA\\Files\\Service\\OwnershipTransferService' => __DIR__ . '/..' . '/../lib/Service/OwnershipTransferService.php',
|
||||||
|
|
|
@ -31,7 +31,7 @@ use OCP\IDBConnection;
|
||||||
|
|
||||||
class TransferOwnershipMapper extends QBMapper {
|
class TransferOwnershipMapper extends QBMapper {
|
||||||
public function __construct(IDBConnection $db) {
|
public function __construct(IDBConnection $db) {
|
||||||
parent::__construct($db, 'user_transfer_ownership', TransferOwnership::class);
|
parent::__construct($db, 'user_transfer_owner', TransferOwnership::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getById(int $id): TransferOwnership {
|
public function getById(int $id): TransferOwnership {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
|
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
|
||||||
*
|
*
|
||||||
|
@ -24,15 +22,14 @@ declare(strict_types=1);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace OCA\Files\Migration;
|
namespace OCA\Files\Migration;
|
||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use OCP\DB\ISchemaWrapper;
|
use OCP\DB\ISchemaWrapper;
|
||||||
use OCP\Migration\SimpleMigrationStep;
|
|
||||||
use OCP\Migration\IOutput;
|
use OCP\Migration\IOutput;
|
||||||
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
|
|
||||||
class Version11301Date20191113195931 extends SimpleMigrationStep {
|
class Version11301Date20191205150729 extends SimpleMigrationStep {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param IOutput $output
|
* @param IOutput $output
|
||||||
|
@ -44,11 +41,12 @@ class Version11301Date20191113195931 extends SimpleMigrationStep {
|
||||||
/** @var ISchemaWrapper $schema */
|
/** @var ISchemaWrapper $schema */
|
||||||
$schema = $schemaClosure();
|
$schema = $schemaClosure();
|
||||||
|
|
||||||
$table = $schema->createTable('user_transfer_ownership');
|
$table = $schema->createTable('user_transfer_owner');
|
||||||
$table->addColumn('id', 'integer', [
|
$table->addColumn('id', 'bigint', [
|
||||||
'autoincrement' => true,
|
'autoincrement' => true,
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
'length' => 4,
|
'length' => 20,
|
||||||
|
'unsigned' => true,
|
||||||
]);
|
]);
|
||||||
$table->addColumn('source_user', 'string', [
|
$table->addColumn('source_user', 'string', [
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
|
@ -68,7 +66,12 @@ class Version11301Date20191113195931 extends SimpleMigrationStep {
|
||||||
]);
|
]);
|
||||||
$table->setPrimaryKey(['id']);
|
$table->setPrimaryKey(['id']);
|
||||||
|
|
||||||
return $schema;
|
// Quite radical, we just assume no one updates cross beta with a pending request.
|
||||||
|
// Do not try this at home
|
||||||
|
if ($schema->hasTable('user_transfer_ownership')) {
|
||||||
|
$schema->dropTable('user_transfer_ownership');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $schema;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -550,7 +550,7 @@ class MigrationService {
|
||||||
if (!$isUsingDefaultName && \strlen($indexName) > 30) {
|
if (!$isUsingDefaultName && \strlen($indexName) > 30) {
|
||||||
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
|
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
|
||||||
}
|
}
|
||||||
if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength > 23) {
|
if ($isUsingDefaultName && \strlen($table->getName()) - $prefixLength >= 23) {
|
||||||
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
|
throw new \InvalidArgumentException('Primary index name on "' . $table->getName() . '" is too long.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,7 +341,7 @@ class MigrationsTest extends \Test\TestCase {
|
||||||
$table = $this->createMock(Table::class);
|
$table = $this->createMock(Table::class);
|
||||||
$table->expects($this->any())
|
$table->expects($this->any())
|
||||||
->method('getName')
|
->method('getName')
|
||||||
->willReturn(\str_repeat('a', 26));
|
->willReturn(\str_repeat('a', 25));
|
||||||
|
|
||||||
$table->expects($this->once())
|
$table->expects($this->once())
|
||||||
->method('getColumns')
|
->method('getColumns')
|
||||||
|
|
Loading…
Reference in New Issue