Skip to content

Commit

Permalink
Merge pull request #12223 from craftcms/feature/add-index-to-canonica…
Browse files Browse the repository at this point in the history
…lid-column

Add index to elements table for `canonicalId`
  • Loading branch information
brandonkelly authored Oct 31, 2022
2 parents 463a2e0 + d11edd6 commit 86ad95a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Release Notes for Craft CMS 4.4 (WIP)

### Content Management
- Assets, categories, and entries will now redirect to the last-selected source on their index pages when saved. ([#11996](https://github.com/craftcms/cms/discussions/11996))
- Assets, categories, and entries will now redirect to the last-selected source on their index pages when saved. ([#11996](https://github.com/craftcms/cms/discussions/11996))

### System
- Improved element deletion performance. ([#12223](https://github.com/craftcms/cms/pull/12223))
2 changes: 1 addition & 1 deletion src/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'id' => 'CraftCMS',
'name' => 'Craft CMS',
'version' => '4.3.1',
'schemaVersion' => '4.0.0.9',
'schemaVersion' => '4.4.0.0',
'minVersionRequired' => '3.7.11',
'basePath' => dirname(__DIR__), // Defines the @app alias
'runtimePath' => '@storage/runtime', // Defines the @runtime alias
Expand Down
1 change: 1 addition & 0 deletions src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ public function createIndexes(): void
$this->createIndex(null, Table::ELEMENTS, ['fieldLayoutId'], false);
$this->createIndex(null, Table::ELEMENTS, ['type'], false);
$this->createIndex(null, Table::ELEMENTS, ['enabled'], false);
$this->createIndex(null, Table::ELEMENTS, ['canonicalId'], false);
$this->createIndex(null, Table::ELEMENTS, ['archived', 'dateCreated'], false);
$this->createIndex(null, Table::ELEMENTS, ['archived', 'dateDeleted', 'draftId', 'revisionId', 'canonicalId'], false);
$this->createIndex(null, Table::ELEMENTS, ['archived', 'dateDeleted', 'draftId', 'revisionId', 'canonicalId', 'enabled'], false);
Expand Down
30 changes: 30 additions & 0 deletions src/migrations/m221028_130548_add_canonical_id_index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace craft\migrations;

use craft\db\Migration;
use craft\db\Table;

/**
* m221028_130548_add_canonical_id_index migration.
*/
class m221028_130548_add_canonical_id_index extends Migration
{
/**
* @inheritdoc
*/
public function safeUp(): bool
{
$this->createIndexIfMissing(Table::ELEMENTS, ['canonicalId'], false);
return true;
}

/**
* @inheritdoc
*/
public function safeDown(): bool
{
$this->dropIndexIfExists(Table::ELEMENTS, ['canonicalId'], false);
return true;
}
}

0 comments on commit 86ad95a

Please sign in to comment.