-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daniel Berthereau
authored and
Daniel Berthereau
committed
Feb 19, 2024
1 parent
84eedf4
commit 89a3864
Showing
3 changed files
with
26 additions
and
2 deletions.
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
19 changes: 19 additions & 0 deletions
19
application/data/migrations/20240219000000_AddIndexMediaType.php
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Omeka\Db\Migrations; | ||
|
||
use Doctrine\DBAL\Connection; | ||
use Omeka\Db\Migration\MigrationInterface; | ||
|
||
class AddIndexMediaType implements MigrationInterface | ||
{ | ||
public function up(Connection $conn) | ||
{ | ||
try { | ||
$conn->executeStatement('ALTER TABLE `media` CHANGE `media_type` `media_type` varchar(190) COLLATE "utf8mb4_unicode_ci" NULL AFTER `source`;'); | ||
$conn->executeStatement('ALTER TABLE `media` ADD INDEX `media_type` (`media_type`);'); | ||
} catch (\Exception $e) { | ||
// Index exists. | ||
} | ||
} | ||
} |
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