<?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('provider_credentials', function (Blueprint $table) {
            $table->id();
            $table->foreignId('provider_connection_id')
                ->constrained('provider_connections')
                ->cascadeOnDelete();
            $table->string('type')->default('client_secret');
            $table->text('payload');
            $table->timestamps();

            $table->unique('provider_connection_id');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('provider_credentials');
    }
};
