Skip to content
Merged
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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
[#758](https://github.com/nextcloud/cookbook/pull/758) @christianlupus
- Added issue template and documentation regarding website support
[#759](https://github.com/nextcloud/cookbook/pull/759) @christianlupus
- Avoid sharing of recipes does break the database upgrade process
[#755](https://github.com/nextcloud/cookbook/pull/755) @christianlupus

### Removed
- Obsolete API routes that are no longer working due to missing files
Expand Down
5 changes: 0 additions & 5 deletions lib/Migration/Version000000Date20210427082010.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
*/
$schema = $schemaClosure();

$namesTable = $schema->getTable('cookbook_names');
if (! $namesTable->hasPrimaryKey()) {
$namesTable->setPrimaryKey(['recipe_id']);
}

$categoriesTable = $schema->getTable('cookbook_categories');
if (! $categoriesTable->hasIndex('categories_recipe_idx')) {
$categoriesTable->addIndex([
Expand Down
42 changes: 42 additions & 0 deletions lib/Migration/Version000000Date20210701093123.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

declare(strict_types=1);

namespace OCA\Cookbook\Migration;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

/**
* Auto-generated migration step: Please modify to your needs!
*/
class Version000000Date20210701093123 extends SimpleMigrationStep {

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/**
* @var ISchemaWrapper $schema
*/
$schema = $schemaClosure();

$namesTable = $schema->getTable('cookbook_names');
if ($namesTable->hasPrimaryKey()) {
$namesTable->dropPrimaryKey();
}
if (! $namesTable->hasIndex('names_recipe_idx')) {
$namesTable->addUniqueIndex([
'recipe_id',
'user_id'
], 'names_recipe_idx');
}

return $schema;
}
}