<?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('terminal_prompts', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('terminal_id')->comment('终端ID');
            $table->text('prompt_template')->comment('提示词模板');
            $table->json('variables')->nullable()->comment('变量配置');
            $table->timestamps();

            // 添加外键约束
            $table->foreign('terminal_id')
                  ->references('id')
                  ->on('terminals')
                  ->onDelete('cascade');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('terminal_prompts');
    }
};
