Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions src/migrations/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ class Install extends Migration
*/
public function safeUp(): bool
{
// Cleanup
$this->_dropTables();

// Create the webhookgroups table
$this->archiveTableIfExists('{{%webhookgroups}}');
$this->createTable('{{%webhookgroups}}', [
'id' => $this->primaryKey(),
'name' => $this->string()->notNull(),
Expand All @@ -30,6 +28,7 @@ public function safeUp(): bool
]);

// Create the webhooks table
$this->archiveTableIfExists('{{%webhooks}}');
$this->createTable('{{%webhooks}}', [
'id' => $this->primaryKey(),
'groupId' => $this->integer()->null(),
Expand All @@ -52,6 +51,7 @@ public function safeUp(): bool
]);

// Create the webhookrequests table
$this->archiveTableIfExists('{{%webhookrequests}}');
$this->createTable('{{%webhookrequests}}', [
'id' => $this->primaryKey(),
'webhookId' => $this->integer(),
Expand Down Expand Up @@ -86,15 +86,11 @@ public function safeUp(): bool
* @inheritdoc
*/
public function safeDown(): bool
{
$this->_dropTables();
return true;
}

private function _dropTables(): void
{
$this->dropTableIfExists('{{%webhookrequests}}');
$this->dropTableIfExists('{{%webhooks}}');
$this->dropTableIfExists('{{%webhookgroups}}');

return true;
}
}
Loading