Skip to content

Commit 8663ddd

Browse files
committed
Fixed the payloadTemplate migration
1 parent 03a2152 commit 8663ddd

File tree

4 files changed

+33
-28
lines changed

4 files changed

+33
-28
lines changed

CHANGELOG.md

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

55
### Fixed
66
- Fixed a bug where it wasn’t possible to create or edit webhooks if a plugin contained an invalid class. ([#8](https://github.com/craftcms/webhooks/issues/8))
7+
- Fixed a SQL error that would occur on installs that had been updated from Webhooks 1.x.
78

89
## 2.0.0 - 2019-03-19
910

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Plugin extends \craft\base\Plugin
4848
/**
4949
* @inheritdoc
5050
*/
51-
public $schemaVersion = '2.0.0';
51+
public $schemaVersion = '2.0.1';
5252

5353
// Public Methods
5454
// =========================================================================

src/migrations/m190112_00000_json_payload.php

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace craft\webhooks\migrations;
4+
5+
use Craft;
6+
use craft\db\Migration;
7+
8+
/**
9+
* m190320_182458_payload_template_col migration.
10+
*/
11+
class m190320_182458_payload_template_col extends Migration
12+
{
13+
/**
14+
* @inheritdoc
15+
*/
16+
public function safeUp()
17+
{
18+
if (!$this->db->columnExists('{{%webhooks}}', 'payloadTemplate')) {
19+
$this->addColumn('{{%webhooks}}', 'payloadTemplate', $this->mediumText()->after('eventAttributes'));
20+
}
21+
}
22+
23+
/**
24+
* @inheritdoc
25+
*/
26+
public function safeDown()
27+
{
28+
echo "m190320_182458_payload_template_col cannot be reverted.\n";
29+
return false;
30+
}
31+
}

0 commit comments

Comments
 (0)