]> BookStack Code Mirror - bookstack/blob - database/migrations/2021_12_07_111343_create_webhooks_table.php
Opensearch: Fixed XML declaration when php short tags enabled
[bookstack] / database / migrations / 2021_12_07_111343_create_webhooks_table.php
1 <?php
2
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Blueprint;
5 use Illuminate\Support\Facades\Schema;
6
7 return new class extends Migration
8 {
9     /**
10      * Run the migrations.
11      */
12     public function up(): void
13     {
14         Schema::create('webhooks', function (Blueprint $table) {
15             $table->increments('id');
16             $table->string('name', 150);
17             $table->boolean('active');
18             $table->string('endpoint', 500);
19             $table->timestamps();
20
21             $table->index('name');
22             $table->index('active');
23         });
24
25         Schema::create('webhook_tracked_events', function (Blueprint $table) {
26             $table->increments('id');
27             $table->integer('webhook_id');
28             $table->string('event', 50);
29             $table->timestamps();
30
31             $table->index('event');
32             $table->index('webhook_id');
33         });
34     }
35
36     /**
37      * Reverse the migrations.
38      */
39     public function down(): void
40     {
41         Schema::dropIfExists('webhooks');
42         Schema::dropIfExists('webhook_tracked_events');
43     }
44 };