Shorten resource table names to allow install on oracle again

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-07-12 11:55:19 +02:00
parent e3126fa091
commit b7de6d7a24
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
6 changed files with 20 additions and 23 deletions

View File

@ -72,9 +72,9 @@ class UpdateCalendarResourcesRoomsBackgroundJob extends TimedJob {
$this->roomManager = $roomManager;
$this->db = $dbConnection;
$this->calDavBackend = $calDavBackend;
$this->resourceDbTable = 'calendar_resources_cache';
$this->resourceDbTable = 'calendar_resources';
$this->resourcePrincipalUri = 'principals/calendar-resources';
$this->roomDbTable = 'calendar_rooms_cache';
$this->roomDbTable = 'calendar_rooms';
$this->roomPrincipalUri = 'principals/calendar-rooms';
// run once an hour

View File

@ -68,7 +68,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
$this->groupManager = $groupManager;
$this->logger = $logger;
$this->principalPrefix = $principalPrefix;
$this->dbTableName = 'calendar_' . $dbPrefix . '_cache';
$this->dbTableName = 'calendar_' . $dbPrefix;
}
/**

View File

@ -27,9 +27,6 @@ use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version1005Date20180530124431 extends SimpleMigrationStep {
/**
@ -45,8 +42,8 @@ class Version1005Date20180530124431 extends SimpleMigrationStep {
$types = ['resources', 'rooms'];
foreach($types as $type) {
if (!$schema->hasTable('calendar_' . $type . '_cache')) {
$table = $schema->createTable('calendar_' . $type . '_cache');
if (!$schema->hasTable('calendar_' . $type)) {
$table = $schema->createTable('calendar_' . $type);
$table->addColumn('id', Type::BIGINT, [
'autoincrement' => true,
@ -75,10 +72,10 @@ class Version1005Date20180530124431 extends SimpleMigrationStep {
'length' => 4000,
]);
$table->setPrimaryKey(['id'], 'calendar_' . $type . '_cache_id_idx');
$table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_cache_backendresource_idx');
$table->addIndex(['email'], 'calendar_' . $type . '_cache_email_idx');
$table->addIndex(['displayname'], 'calendar_' . $type . '_cache_displayname_idx');
$table->setPrimaryKey(['id']);
$table->addIndex(['backend_id', 'resource_id'], 'calendar_' . $type . '_bkdrsc');
$table->addIndex(['email'], 'calendar_' . $type . '_email');
$table->addIndex(['displayname'], 'calendar_' . $type . '_name');
}
}

View File

@ -60,8 +60,8 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
protected function tearDown() {
$query = self::$realDatabase->getQueryBuilder();
$query->delete('calendar_resources_cache')->execute();
$query->delete('calendar_rooms_cache')->execute();
$query->delete('calendar_resources')->execute();
$query->delete('calendar_rooms')->execute();
}
/**
@ -170,7 +170,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
$this->backgroundJob->run([]);
$query = self::$realDatabase->getQueryBuilder();
$query->select('*')->from('calendar_resources_cache');
$query->select('*')->from('calendar_resources');
$rows = [];
$stmt = $query->execute();
@ -227,7 +227,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
protected function createTestResourcesInCache() {
$query = self::$realDatabase->getQueryBuilder();
$query->insert('calendar_resources_cache')
$query->insert('calendar_resources')
->values([
'backend_id' => $query->createNamedParameter('backend1'),
'resource_id' => $query->createNamedParameter('res1'),
@ -236,7 +236,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
'group_restrictions' => $query->createNamedParameter('[]'),
])
->execute();
$query->insert('calendar_resources_cache')
$query->insert('calendar_resources')
->values([
'backend_id' => $query->createNamedParameter('backend1'),
'resource_id' => $query->createNamedParameter('res2'),
@ -245,7 +245,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
'group_restrictions' => $query->createNamedParameter('[]'),
])
->execute();
$query->insert('calendar_resources_cache')
$query->insert('calendar_resources')
->values([
'backend_id' => $query->createNamedParameter('backend2'),
'resource_id' => $query->createNamedParameter('res3'),
@ -254,7 +254,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
'group_restrictions' => $query->createNamedParameter('[]'),
])
->execute();
$query->insert('calendar_resources_cache')
$query->insert('calendar_resources')
->values([
'backend_id' => $query->createNamedParameter('backend2'),
'resource_id' => $query->createNamedParameter('res4'),
@ -263,7 +263,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
'group_restrictions' => $query->createNamedParameter('[]'),
])
->execute();
$query->insert('calendar_resources_cache')
$query->insert('calendar_resources')
->values([
'backend_id' => $query->createNamedParameter('backend3'),
'resource_id' => $query->createNamedParameter('res5'),
@ -272,7 +272,7 @@ class UpdateCalendarResourcesRoomsBackgroundJobTest extends TestCase {
'group_restrictions' => $query->createNamedParameter('[]'),
])
->execute();
$query->insert('calendar_resources_cache')
$query->insert('calendar_resources')
->values([
'backend_id' => $query->createNamedParameter('backend3'),
'resource_id' => $query->createNamedParameter('res6'),

View File

@ -29,7 +29,7 @@ Class ResourcePrincipalBackendTest extends AbstractPrincipalBackendTest {
$this->principalBackend = new ResourcePrincipalBackend($this->dbConnection,
$this->userSession, $this->groupManager, $this->logger);
$this->expectedDbTable = 'calendar_resources_cache';
$this->expectedDbTable = 'calendar_resources';
$this->principalPrefix = 'principals/calendar-resources';
}
}

View File

@ -29,7 +29,7 @@ Class RoomPrincipalBackendTest extends AbstractPrincipalBackendTest {
$this->principalBackend = new RoomPrincipalBackend($this->dbConnection,
$this->userSession, $this->groupManager, $this->logger);
$this->expectedDbTable = 'calendar_rooms_cache';
$this->expectedDbTable = 'calendar_rooms';
$this->principalPrefix = 'principals/calendar-rooms';
}
}