Merge pull request #10213 from nextcloud/bugfix/noid/shorten-resource-table-names-to-allow-install-on-oracle
Shorten resource table names to allow install on oracle again
This commit is contained in:
commit
09d5b61c9e
|
@ -45,7 +45,7 @@ class CleanupInvitationTokenJob extends TimedJob {
|
||||||
|
|
||||||
public function run($argument) {
|
public function run($argument) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->delete('calendar_invitation_tokens')
|
$query->delete('calendar_invitations')
|
||||||
->where($query->expr()->lt('expiration',
|
->where($query->expr()->lt('expiration',
|
||||||
$query->createNamedParameter($this->timeFactory->getTime())))
|
$query->createNamedParameter($this->timeFactory->getTime())))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
|
@ -72,9 +72,9 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
|
||||||
$this->roomManager = $roomManager;
|
$this->roomManager = $roomManager;
|
||||||
$this->db = $dbConnection;
|
$this->db = $dbConnection;
|
||||||
$this->calDavBackend = $calDavBackend;
|
$this->calDavBackend = $calDavBackend;
|
||||||
$this->resourceDbTable = 'calendar_resources_cache';
|
$this->resourceDbTable = 'calendar_resources';
|
||||||
$this->resourcePrincipalUri = 'principals/calendar-resources';
|
$this->resourcePrincipalUri = 'principals/calendar-resources';
|
||||||
$this->roomDbTable = 'calendar_rooms_cache';
|
$this->roomDbTable = 'calendar_rooms';
|
||||||
$this->roomPrincipalUri = 'principals/calendar-rooms';
|
$this->roomPrincipalUri = 'principals/calendar-rooms';
|
||||||
|
|
||||||
// run once an hour
|
// run once an hour
|
||||||
|
|
|
@ -68,7 +68,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
||||||
$this->groupManager = $groupManager;
|
$this->groupManager = $groupManager;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
$this->principalPrefix = $principalPrefix;
|
$this->principalPrefix = $principalPrefix;
|
||||||
$this->dbTableName = 'calendar_' . $dbPrefix . '_cache';
|
$this->dbTableName = 'calendar_' . $dbPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -536,7 +536,7 @@ class IMipPlugin extends SabreIMipPlugin {
|
||||||
$uid = $vevent->{'UID'};
|
$uid = $vevent->{'UID'};
|
||||||
|
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->insert('calendar_invitation_tokens')
|
$query->insert('calendar_invitations')
|
||||||
->values([
|
->values([
|
||||||
'token' => $query->createNamedParameter($token),
|
'token' => $query->createNamedParameter($token),
|
||||||
'attendee' => $query->createNamedParameter($attendee),
|
'attendee' => $query->createNamedParameter($attendee),
|
||||||
|
|
|
@ -162,7 +162,7 @@ class InvitationResponseController extends Controller {
|
||||||
private function getTokenInformation(string $token) {
|
private function getTokenInformation(string $token) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->select('*')
|
$query->select('*')
|
||||||
->from('calendar_invitation_tokens')
|
->from('calendar_invitations')
|
||||||
->where($query->expr()->eq('token', $query->createNamedParameter($token)));
|
->where($query->expr()->eq('token', $query->createNamedParameter($token)));
|
||||||
$stmt = $query->execute();
|
$stmt = $query->execute();
|
||||||
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||||
|
|
|
@ -27,9 +27,6 @@ use OCP\DB\ISchemaWrapper;
|
||||||
use OCP\Migration\SimpleMigrationStep;
|
use OCP\Migration\SimpleMigrationStep;
|
||||||
use OCP\Migration\IOutput;
|
use OCP\Migration\IOutput;
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated migration step: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
class Version1005Date20180530124431 extends SimpleMigrationStep {
|
class Version1005Date20180530124431 extends SimpleMigrationStep {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,8 +42,8 @@ class Version1005Date20180530124431 extends SimpleMigrationStep {
|
||||||
|
|
||||||
$types = ['resources', 'rooms'];
|
$types = ['resources', 'rooms'];
|
||||||
foreach($types as $type) {
|
foreach($types as $type) {
|
||||||
if (!$schema->hasTable('calendar_' . $type . '_cache')) {
|
if (!$schema->hasTable('calendar_' . $type)) {
|
||||||
$table = $schema->createTable('calendar_' . $type . '_cache');
|
$table = $schema->createTable('calendar_' . $type);
|
||||||
|
|
||||||
$table->addColumn('id', Type::BIGINT, [
|
$table->addColumn('id', Type::BIGINT, [
|
||||||
'autoincrement' => true,
|
'autoincrement' => true,
|
||||||
|
@ -75,10 +72,10 @@ class Version1005Date20180530124431 extends SimpleMigrationStep {
|
||||||
'length' => 4000,
|
'length' => 4000,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$table->setPrimaryKey(['id'], 'calendar_' . $type . '_cache_id_idx');
|
$table->setPrimaryKey(['id']);
|
||||||
$table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_cache_backendresource_idx');
|
$table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc');
|
||||||
$table->addIndex(['email'], 'calendar_' . $type . '_cache_email_idx');
|
$table->addIndex(['email'], 'calendar_' . $type . '_email');
|
||||||
$table->addIndex(['displayname'], 'calendar_' . $type . '_cache_displayname_idx');
|
$table->addIndex(['displayname'], 'calendar_' . $type . '_name');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ class Version1006Date20180619154313 extends SimpleMigrationStep {
|
||||||
/** @var ISchemaWrapper $schema */
|
/** @var ISchemaWrapper $schema */
|
||||||
$schema = $schemaClosure();
|
$schema = $schemaClosure();
|
||||||
|
|
||||||
if (!$schema->hasTable('calendar_invitation_tokens')) {
|
if (!$schema->hasTable('calendar_invitations')) {
|
||||||
$table = $schema->createTable('calendar_invitation_tokens');
|
$table = $schema->createTable('calendar_invitations');
|
||||||
|
|
||||||
$table->addColumn('id', Type::BIGINT, [
|
$table->addColumn('id', Type::BIGINT, [
|
||||||
'autoincrement' => true,
|
'autoincrement' => true,
|
||||||
|
@ -62,8 +62,8 @@ class Version1006Date20180619154313 extends SimpleMigrationStep {
|
||||||
'unsigned' => true,
|
'unsigned' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$table->setPrimaryKey(['id'], 'calendar_invitation_tokens_id_idx');
|
$table->setPrimaryKey(['id']);
|
||||||
$table->addIndex(['token'], 'calendar_invitation_tokens_token_idx');
|
$table->addIndex(['token'], 'calendar_invitation_tokens');
|
||||||
|
|
||||||
return $schema;
|
return $schema;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ class CleanupInvitationTokenJobTest extends TestCase {
|
||||||
|
|
||||||
$queryBuilder->expects($this->at(0))
|
$queryBuilder->expects($this->at(0))
|
||||||
->method('delete')
|
->method('delete')
|
||||||
->with('calendar_invitation_tokens')
|
->with('calendar_invitations')
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(3))
|
$queryBuilder->expects($this->at(3))
|
||||||
->method('where')
|
->method('where')
|
||||||
|
|
|
@ -60,8 +60,8 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
|
|
||||||
protected function tearDown() {
|
protected function tearDown() {
|
||||||
$query = self::$realDatabase->getQueryBuilder();
|
$query = self::$realDatabase->getQueryBuilder();
|
||||||
$query->delete('calendar_resources_cache')->execute();
|
$query->delete('calendar_resources')->execute();
|
||||||
$query->delete('calendar_rooms_cache')->execute();
|
$query->delete('calendar_rooms')->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -170,7 +170,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
$this->backgroundJob->run([]);
|
$this->backgroundJob->run([]);
|
||||||
|
|
||||||
$query = self::$realDatabase->getQueryBuilder();
|
$query = self::$realDatabase->getQueryBuilder();
|
||||||
$query->select('*')->from('calendar_resources_cache');
|
$query->select('*')->from('calendar_resources');
|
||||||
|
|
||||||
$rows = [];
|
$rows = [];
|
||||||
$stmt = $query->execute();
|
$stmt = $query->execute();
|
||||||
|
@ -227,7 +227,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
|
|
||||||
protected function createTestResourcesInCache() {
|
protected function createTestResourcesInCache() {
|
||||||
$query = self::$realDatabase->getQueryBuilder();
|
$query = self::$realDatabase->getQueryBuilder();
|
||||||
$query->insert('calendar_resources_cache')
|
$query->insert('calendar_resources')
|
||||||
->values([
|
->values([
|
||||||
'backend_id' => $query->createNamedParameter('backend1'),
|
'backend_id' => $query->createNamedParameter('backend1'),
|
||||||
'resource_id' => $query->createNamedParameter('res1'),
|
'resource_id' => $query->createNamedParameter('res1'),
|
||||||
|
@ -236,7 +236,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
'group_restrictions' => $query->createNamedParameter('[]'),
|
'group_restrictions' => $query->createNamedParameter('[]'),
|
||||||
])
|
])
|
||||||
->execute();
|
->execute();
|
||||||
$query->insert('calendar_resources_cache')
|
$query->insert('calendar_resources')
|
||||||
->values([
|
->values([
|
||||||
'backend_id' => $query->createNamedParameter('backend1'),
|
'backend_id' => $query->createNamedParameter('backend1'),
|
||||||
'resource_id' => $query->createNamedParameter('res2'),
|
'resource_id' => $query->createNamedParameter('res2'),
|
||||||
|
@ -245,7 +245,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
'group_restrictions' => $query->createNamedParameter('[]'),
|
'group_restrictions' => $query->createNamedParameter('[]'),
|
||||||
])
|
])
|
||||||
->execute();
|
->execute();
|
||||||
$query->insert('calendar_resources_cache')
|
$query->insert('calendar_resources')
|
||||||
->values([
|
->values([
|
||||||
'backend_id' => $query->createNamedParameter('backend2'),
|
'backend_id' => $query->createNamedParameter('backend2'),
|
||||||
'resource_id' => $query->createNamedParameter('res3'),
|
'resource_id' => $query->createNamedParameter('res3'),
|
||||||
|
@ -254,7 +254,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
'group_restrictions' => $query->createNamedParameter('[]'),
|
'group_restrictions' => $query->createNamedParameter('[]'),
|
||||||
])
|
])
|
||||||
->execute();
|
->execute();
|
||||||
$query->insert('calendar_resources_cache')
|
$query->insert('calendar_resources')
|
||||||
->values([
|
->values([
|
||||||
'backend_id' => $query->createNamedParameter('backend2'),
|
'backend_id' => $query->createNamedParameter('backend2'),
|
||||||
'resource_id' => $query->createNamedParameter('res4'),
|
'resource_id' => $query->createNamedParameter('res4'),
|
||||||
|
@ -263,7 +263,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
'group_restrictions' => $query->createNamedParameter('[]'),
|
'group_restrictions' => $query->createNamedParameter('[]'),
|
||||||
])
|
])
|
||||||
->execute();
|
->execute();
|
||||||
$query->insert('calendar_resources_cache')
|
$query->insert('calendar_resources')
|
||||||
->values([
|
->values([
|
||||||
'backend_id' => $query->createNamedParameter('backend3'),
|
'backend_id' => $query->createNamedParameter('backend3'),
|
||||||
'resource_id' => $query->createNamedParameter('res5'),
|
'resource_id' => $query->createNamedParameter('res5'),
|
||||||
|
@ -272,7 +272,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
|
||||||
'group_restrictions' => $query->createNamedParameter('[]'),
|
'group_restrictions' => $query->createNamedParameter('[]'),
|
||||||
])
|
])
|
||||||
->execute();
|
->execute();
|
||||||
$query->insert('calendar_resources_cache')
|
$query->insert('calendar_resources')
|
||||||
->values([
|
->values([
|
||||||
'backend_id' => $query->createNamedParameter('backend3'),
|
'backend_id' => $query->createNamedParameter('backend3'),
|
||||||
'resource_id' => $query->createNamedParameter('res6'),
|
'resource_id' => $query->createNamedParameter('res6'),
|
||||||
|
|
|
@ -29,7 +29,7 @@ Class ResourcePrincipalBackendTest extends AbstractPrincipalBackendTest {
|
||||||
|
|
||||||
$this->principalBackend = new ResourcePrincipalBackend($this->dbConnection,
|
$this->principalBackend = new ResourcePrincipalBackend($this->dbConnection,
|
||||||
$this->userSession, $this->groupManager, $this->logger);
|
$this->userSession, $this->groupManager, $this->logger);
|
||||||
$this->expectedDbTable = 'calendar_resources_cache';
|
$this->expectedDbTable = 'calendar_resources';
|
||||||
$this->principalPrefix = 'principals/calendar-resources';
|
$this->principalPrefix = 'principals/calendar-resources';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ Class RoomPrincipalBackendTest extends AbstractPrincipalBackendTest {
|
||||||
|
|
||||||
$this->principalBackend = new RoomPrincipalBackend($this->dbConnection,
|
$this->principalBackend = new RoomPrincipalBackend($this->dbConnection,
|
||||||
$this->userSession, $this->groupManager, $this->logger);
|
$this->userSession, $this->groupManager, $this->logger);
|
||||||
$this->expectedDbTable = 'calendar_rooms_cache';
|
$this->expectedDbTable = 'calendar_rooms';
|
||||||
$this->principalPrefix = 'principals/calendar-rooms';
|
$this->principalPrefix = 'principals/calendar-rooms';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class IMipPluginTest extends TestCase {
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(0))
|
$queryBuilder->expects($this->at(0))
|
||||||
->method('insert')
|
->method('insert')
|
||||||
->with('calendar_invitation_tokens')
|
->with('calendar_invitations')
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(8))
|
$queryBuilder->expects($this->at(8))
|
||||||
->method('values')
|
->method('values')
|
||||||
|
@ -176,7 +176,7 @@ class IMipPluginTest extends TestCase {
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(0))
|
$queryBuilder->expects($this->at(0))
|
||||||
->method('insert')
|
->method('insert')
|
||||||
->with('calendar_invitation_tokens')
|
->with('calendar_invitations')
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(8))
|
$queryBuilder->expects($this->at(8))
|
||||||
->method('values')
|
->method('values')
|
||||||
|
@ -264,7 +264,7 @@ class IMipPluginTest extends TestCase {
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(0))
|
$queryBuilder->expects($this->at(0))
|
||||||
->method('insert')
|
->method('insert')
|
||||||
->with('calendar_invitation_tokens')
|
->with('calendar_invitations')
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(8))
|
$queryBuilder->expects($this->at(8))
|
||||||
->method('values')
|
->method('values')
|
||||||
|
|
|
@ -438,7 +438,7 @@ EOF;
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(1))
|
$queryBuilder->expects($this->at(1))
|
||||||
->method('from')
|
->method('from')
|
||||||
->with('calendar_invitation_tokens')
|
->with('calendar_invitations')
|
||||||
->will($this->returnValue($queryBuilder));
|
->will($this->returnValue($queryBuilder));
|
||||||
$queryBuilder->expects($this->at(4))
|
$queryBuilder->expects($this->at(4))
|
||||||
->method('where')
|
->method('where')
|
||||||
|
|
Loading…
Reference in New Issue