amber-laravel/database/migrations/2024_07_23_093256_create_tools_table.php
2024-07-24 16:13:16 +08:00

43 lines
951 B
PHP

<?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('tools', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('description')->nullable();
$table->string('discovery_url')->index();
$table->string('api_key')->nullable();
// 数据
$table->json('data')->nullable();
// user id
$table->unsignedBigInteger('user_id')->index();
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tools');
}
};