Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Those groups of people can then be used by any other app for sharing purpose.
]]>
</description>
<version>36.0.0-dev.1</version>
<version>36.0.0-dev.2</version>
<licence>AGPL-3.0-or-later</licence>
<author>Maxence Lange</author>
<types>
Expand Down
9 changes: 0 additions & 9 deletions lib/Entity/TeamFavorite.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

namespace OCA\Circles\Entity;

use DateTime;
use DateTimeZone;
use OCP\AppFramework\ORM\Attribute\Column;
use OCP\AppFramework\ORM\Attribute\Entity as EntityAttribute;
use OCP\AppFramework\ORM\Attribute\Id;
Expand All @@ -30,11 +28,4 @@ final class TeamFavorite {

#[Column(name: 'position', type: ColumnType::Integer)]
public int $position = 0;

#[Column(name: 'created', type: ColumnType::Datetime)]
public DateTime $created;

public function __construct() {
$this->created = new DateTime('now', new DateTimeZone('UTC'));
}
}
60 changes: 60 additions & 0 deletions lib/Migration/Version360000Date20260922120100.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Circles\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Schema\ColumnType;
use OCP\DB\Schema\SchemaException;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version360000Date20260922120100 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The closure returns a schema wrapper.
* @param array $options
*
* @throws SchemaException
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

if (!$schema->hasTable('circles_team_favorites')) {
$table = $schema->createTable('circles_team_favorites');
$table->addColumn('id', ColumnType::Integer, [
'autoincrement' => true,
'notnull' => true,
'length' => 8,
'unsigned' => true,
]);
$table->addColumn('user_id', ColumnType::String, [
'length' => 255,
'notnull' => true,
]);
$table->addColumn('circle_id', ColumnType::String, [
'length' => 32,
'notnull' => true,
]);
$table->addColumn('position', ColumnType::Integer, [
'notnull' => true,
'unsigned' => true,
]);

$table->setPrimaryKey(['id']);
$table->addUniqueIndex(['user_id', 'circle_id']);
$table->addIndex(['user_id', 'position']);
$table->addIndex(['circle_id']);
}

return $schema;
}
}
49 changes: 49 additions & 0 deletions lib/Migration/Version360000Date20261016134000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\Circles\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\Attributes\AddIndex;
use OCP\Migration\Attributes\DropColumn;
use OCP\Migration\Attributes\IndexType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

#[AddIndex('circles_team_favorites', IndexType::INDEX, 'restore the circle cleanup index')]
#[DropColumn(table: 'circles_team_favorites', name: 'created')]
class Version360000Date20261016134000 extends SimpleMigrationStep {
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();

if (!$schema->hasTable('circles_team_favorites')) {
return null;
}

$table = $schema->getTable('circles_team_favorites');
if ($table->hasColumn('created')) {
$table->dropColumn('created');
}

$hasCircleIndex = false;
foreach ($table->getIndexes() as $index) {
if ($index->getColumns() === ['circle_id']) {
$hasCircleIndex = true;
break;
}
}
if (!$hasCircleIndex) {
$table->addIndex(['circle_id']);
}

return $schema;
}
}
2 changes: 1 addition & 1 deletion tests/unit/lib/Repository/TeamFavoriteRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private function member(string $circleId, string $singleId, string $userId, int
*/
private function rows(): array {
$query = $this->db->getQueryBuilder();
$query->select('id', 'circle_id', 'created')->from('circles_team_favorites')
$query->select('id', 'circle_id')->from('circles_team_favorites')
->where($query->expr()->eq('user_id', $query->createNamedParameter($this->userId)))
->orderBy('id');
$result = $query->executeQuery();
Expand Down
Loading