-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: apply migration only for pg and sqlite
- Loading branch information
Showing
1 changed file
with
8 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
<?php | ||
namespace OC\Migrations; | ||
|
||
use Doctrine\DBAL\Platforms\PostgreSqlPlatform; | ||
use Doctrine\DBAL\Platforms\SqlitePlatform; | ||
use OCP\IDBConnection; | ||
use OCP\Migration\ISqlMigration; | ||
|
||
class Version20240507143125 implements ISqlMigration { | ||
public function sql(IDBConnection $connection) { | ||
return ["CREATE UNIQUE INDEX child_share_unique ON oc_share (share_with, parent) | ||
$dbPlatform = $connection->getDatabasePlatform(); | ||
if ($dbPlatform instanceof PostgreSqlPlatform || $dbPlatform instanceof SqlitePlatform) { | ||
return ["CREATE UNIQUE INDEX child_share_unique ON oc_share (share_with, parent) | ||
WHERE parent IS NOT NULL AND share_type = 2"]; | ||
} | ||
|
||
return []; | ||
} | ||
} |