Skip to content

Commit

Permalink
fix: add equivalent index for mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
IljaN committed May 8, 2024
1 parent 1b5c5fa commit 9a29ebb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/Migrations/Version20240507143125.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace OC\Migrations;

use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use OCP\IDBConnection;
Expand All @@ -14,6 +15,13 @@ public function sql(IDBConnection $connection) {
WHERE parent IS NOT NULL AND share_type = 2"];
}

if ($dbPlatform instanceof MySqlPlatform) {
// This should be preceise enough as mysql ignores nulls in unique indexes
return [
"CREATE UNIQUE INDEX child_share_unique ON oc_share (item_source, share_with, share_type, parent);"
];
}

return [];
}
}

0 comments on commit 9a29ebb

Please sign in to comment.