move into sonardesk
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('api_tokens', function (Blueprint $t): void {
|
||||
$t->id();
|
||||
$t->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$t->string('name');
|
||||
$t->string('token', 64)->unique();
|
||||
$t->json('abilities')->nullable();
|
||||
$t->timestamp('last_used_at')->nullable();
|
||||
$t->timestamp('expires_at')->nullable();
|
||||
$t->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('api_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('webhooks', function (Blueprint $t): void {
|
||||
$t->id();
|
||||
$t->foreignId('site_id')->nullable()->constrained('sites')->nullOnDelete();
|
||||
$t->string('name');
|
||||
$t->string('url');
|
||||
$t->string('secret');
|
||||
$t->json('events');
|
||||
$t->boolean('is_active')->default(true);
|
||||
$t->unsignedSmallInteger('failure_count')->default(0);
|
||||
$t->timestamp('last_triggered_at')->nullable();
|
||||
$t->timestamps();
|
||||
});
|
||||
Schema::create('webhook_deliveries', function (Blueprint $t): void {
|
||||
$t->id();
|
||||
$t->foreignId('webhook_id')->constrained()->cascadeOnDelete();
|
||||
$t->uuid('uuid')->unique();
|
||||
$t->string('event');
|
||||
$t->json('payload');
|
||||
$t->unsignedSmallInteger('response_status')->nullable();
|
||||
$t->text('response_body')->nullable();
|
||||
$t->unsignedSmallInteger('attempts')->default(0);
|
||||
$t->timestamp('delivered_at')->nullable();
|
||||
$t->timestamp('failed_at')->nullable();
|
||||
$t->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('webhook_deliveries');
|
||||
Schema::dropIfExists('webhooks');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user