From c68d7c5aad422a2d62092eb9556e97b5f2c78e56 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 29 Nov 2020 09:29:38 +0100 Subject: [PATCH] First attempt at webhooks table. --- .../2020_11_12_070604_changes_for_v550.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/database/migrations/2020_11_12_070604_changes_for_v550.php b/database/migrations/2020_11_12_070604_changes_for_v550.php index 096598eb3b..18b1636b63 100644 --- a/database/migrations/2020_11_12_070604_changes_for_v550.php +++ b/database/migrations/2020_11_12_070604_changes_for_v550.php @@ -53,6 +53,8 @@ class ChangesForV550 extends Migration $table->dropColumn('generated'); } ); + Schema::dropIfExists('webhook_messages'); + Schema::dropIfExists('webhooks'); } /** @@ -109,5 +111,37 @@ class ChangesForV550 extends Migration $table->boolean('generated')->default(false); } ); + + // new webhooks table + Schema::create( + 'webhooks', + static function (Blueprint $table) { + $table->bigIncrements('id'); + $table->integer('user_id', false, true); + $table->softDeletes(); + $table->boolean('active')->default(true); + $table->string('trigger',32); + $table->string('response', 32); + $table->string('delivery',32); + $table->string('url',512); + + $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); + } + ); + + // new webhook_messages table + Schema::create( + 'webhook_messages', + static function (Blueprint $table) { + $table->bigIncrements('id'); + $table->integer('webhook_id', false, true); + $table->softDeletes(); + $table->boolean('sent')->default(false); + $table->boolean('errored')->default(false); + $table->string('uuid',64); + $table->longText('message'); + $table->foreign('webhook_id')->references('id')->on('webhooks')->onDelete('cascade'); + } + ); } }