Skip to content

Commit 18896b5

Browse files
committed
Add status index
1 parent aa2fa56 commit 18896b5

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
### Changed
1111
- Webhooks now requires Craft 3.7 or later.
12+
- Improved the performance of clearing out completed webhook request logs. ([#32](https://github.com/craftcms/webhooks/issues/32))
1213

1314
### Fixed
1415
- Fixed an error that could occur when calling `craft\webhooks\Plugin::getRequestData()` if an invalid request ID was passed.

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Plugin extends \craft\base\Plugin
8787
/**
8888
* @inheritdoc
8989
*/
90-
public $schemaVersion = '2.3.1';
90+
public $schemaVersion = '2.4.0';
9191

9292
/**
9393
* @var SendRequestJob[] The request jobs that should be queued up at the end of the web request.

src/migrations/Install.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function safeUp(): bool
7272
$this->createIndex(null, '{{%webhooks}}', ['groupId', 'name']);
7373
$this->createIndex(null, '{{%webhooks}}', ['name'], true);
7474
$this->createIndex(null, '{{%webhookrequests}}', ['debounceKey', 'status']);
75+
$this->createIndex(null, '{{%webhookrequests}}', ['status']);
7576
$this->addForeignKey(null, '{{%webhooks}}', ['groupId'], '{{%webhookgroups}}', ['id'], 'SET NULL');
7677
$this->addForeignKey(null, '{{%webhookrequests}}', ['webhookId'], '{{%webhooks}}', ['id'], 'SET NULL');
7778

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace craft\webhooks\migrations;
4+
5+
use craft\db\Migration;
6+
7+
/**
8+
* m210830_202902_status_index migration.
9+
*/
10+
class m210830_202902_status_index extends Migration
11+
{
12+
/**
13+
* @inheritdoc
14+
*/
15+
public function safeUp(): bool
16+
{
17+
$this->createIndex(null, '{{%webhookrequests}}', ['status']);
18+
return true;
19+
}
20+
21+
/**
22+
* @inheritdoc
23+
*/
24+
public function safeDown(): bool
25+
{
26+
echo "m210830_202902_status_index cannot be reverted.\n";
27+
return false;
28+
}
29+
}

0 commit comments

Comments
 (0)