👁 查看:2026_06_25_162334_create_hotspots_table.php
路径:/home/boguraj1/.trash/database.1/migrations/2026_06_25_162334_create_hotspots_table.php
大小:1.09 KB · 修改:2026-06-25 22:24:14 · 权限:0644 · 可写
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateHotspotsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('hotspots', function (Blueprint $table) {
            $table->id();
            $table->foreignId('newspaper_page_id')->constrained()->onDelete('cascade');
            $table->string('title')->nullable();
            $table->decimal('x_percent', 5, 2);
            $table->decimal('y_percent', 5, 2);
            $table->decimal('width_percent', 5, 2);
            $table->decimal('height_percent', 5, 2);
            $table->enum('link_type', ['url', 'page', 'anchor'])->default('url');
            $table->string('link_value')->nullable();
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });
    }

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