First attempt at webhooks table.

This commit is contained in:
James Cole
2020-11-29 09:29:38 +01:00
parent 0e5e2fcef7
commit c68d7c5aad

View File

@@ -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');
}
);
}
}