Skip to content
Snippets Groups Projects
Unverified Commit 059968e1 authored by Joas Schilling's avatar Joas Schilling Committed by Roeland Jago Douma
Browse files

Pick a shorter name for the transfer ownership table

parent b78a141b
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ return array(
'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php',
'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.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\\Service\\DirectEditingService' => $baseDir . '/../lib/Service/DirectEditingService.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\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__ . '/..' . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.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\\Service\\DirectEditingService' => __DIR__ . '/..' . '/../lib/Service/DirectEditingService.php',
'OCA\\Files\\Service\\OwnershipTransferService' => __DIR__ . '/..' . '/../lib/Service/OwnershipTransferService.php',
......
......@@ -31,7 +31,7 @@ use OCP\IDBConnection;
class TransferOwnershipMapper extends QBMapper {
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 {
......
<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
*
......@@ -24,15 +22,14 @@ declare(strict_types=1);
*
*/
namespace OCA\Files\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version11301Date20191113195931 extends SimpleMigrationStep {
class Version11301Date20191205150729 extends SimpleMigrationStep {
/**
* @param IOutput $output
......@@ -44,11 +41,12 @@ class Version11301Date20191113195931 extends SimpleMigrationStep {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$table = $schema->createTable('user_transfer_ownership');
$table->addColumn('id', 'integer', [
$table = $schema->createTable('user_transfer_owner');
$table->addColumn('id', 'bigint', [
'autoincrement' => true,
'notnull' => true,
'length' => 4,
'length' => 20,
'unsigned' => true,
]);
$table->addColumn('source_user', 'string', [
'notnull' => true,
......@@ -68,7 +66,12 @@ class Version11301Date20191113195931 extends SimpleMigrationStep {
]);
$table->setPrimaryKey(['id']);
// 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) {
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.');
}
}
......
......@@ -60,7 +60,7 @@ class MigrationsTest extends \Test\TestCase {
$this->assertEquals('test_oc_migrations', $this->migrationService->getMigrationsTableName());
}
public function testExecuteUnknownStep() {
$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Version 20170130180000 is unknown.');
......@@ -68,7 +68,7 @@ class MigrationsTest extends \Test\TestCase {
$this->migrationService->executeStep('20170130180000');
}
public function testUnknownApp() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('App not found');
......@@ -76,7 +76,7 @@ class MigrationsTest extends \Test\TestCase {
$migrationService = new MigrationService('unknown-bloody-app', $this->db);
}
public function testExecuteStepWithUnknownClass() {
$this->expectException(\Exception::class);
$this->expectExceptionMessage('Migration step \'X\' is unknown');
......@@ -341,7 +341,7 @@ class MigrationsTest extends \Test\TestCase {
$table = $this->createMock(Table::class);
$table->expects($this->any())
->method('getName')
->willReturn(\str_repeat('a', 26));
->willReturn(\str_repeat('a', 25));
$table->expects($this->once())
->method('getColumns')
......@@ -375,7 +375,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
public function testEnsureOracleIdentifierLengthLimitTooLongTableName() {
$this->expectException(\InvalidArgumentException::class);
......@@ -400,7 +400,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithDefault() {
$this->expectException(\InvalidArgumentException::class);
......@@ -453,7 +453,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
public function testEnsureOracleIdentifierLengthLimitTooLongPrimaryWithName() {
$this->expectException(\InvalidArgumentException::class);
......@@ -496,7 +496,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
public function testEnsureOracleIdentifierLengthLimitTooLongColumnName() {
$this->expectException(\InvalidArgumentException::class);
......@@ -530,7 +530,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
public function testEnsureOracleIdentifierLengthLimitTooLongIndexName() {
$this->expectException(\InvalidArgumentException::class);
......@@ -567,7 +567,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
public function testEnsureOracleIdentifierLengthLimitTooLongForeignKeyName() {
$this->expectException(\InvalidArgumentException::class);
......@@ -607,7 +607,7 @@ class MigrationsTest extends \Test\TestCase {
self::invokePrivate($this->migrationService, 'ensureOracleIdentifierLengthLimit', [$sourceSchema, $schema, 3]);
}
public function testEnsureOracleIdentifierLengthLimitTooLongSequenceName() {
$this->expectException(\InvalidArgumentException::class);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment