feat: tags and tag deploy webhooks
This commit is contained in:
39
database/migrations/2024_02_01_111228_create_tags_table.php
Normal file
39
database/migrations/2024_02_01_111228_create_tags_table.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('tags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->string('name')->unique();
|
||||
$table->foreignId('team_id')->nullable()->constrained()->onDelete('cascade');
|
||||
$table->timestamps();
|
||||
});
|
||||
Schema::create('taggables', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tag_id');
|
||||
$table->unsignedBigInteger('taggable_id');
|
||||
$table->string('taggable_type');
|
||||
$table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
$table->unique(['tag_id', 'taggable_id', 'taggable_type'], 'taggable_unique'); // Composite unique index
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('taggables');
|
||||
Schema::dropIfExists('tags');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user