55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateAnnotationsTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
// Drop table if exists to avoid conflicts
|
|
Schema::dropIfExists('annotations');
|
|
|
|
Schema::create('annotations', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('shape_id')->unique();
|
|
$table->string('spool_no')->nullable();
|
|
$table->string('joint_type')->nullable();
|
|
$table->string('classification')->nullable();
|
|
$table->integer('page_number');
|
|
$table->decimal('x_coordinate', 10, 2);
|
|
$table->decimal('y_coordinate', 10, 2);
|
|
$table->decimal('width', 10, 2)->nullable();
|
|
$table->decimal('height', 10, 2)->nullable();
|
|
$table->enum('shape_type', ['leader_line', 'rect', 'circle', 'triangle', 'text', 'line'])->default('rect');
|
|
$table->text('qr_code_data')->nullable();
|
|
$table->string('pdf_file_path');
|
|
$table->string('created_by')->nullable();
|
|
$table->json('original_start_point')->nullable();
|
|
$table->string('connected_shape_id')->nullable();
|
|
$table->timestamps();
|
|
|
|
// Indexes for better performance
|
|
$table->index('pdf_file_path');
|
|
$table->index('page_number');
|
|
$table->index(['pdf_file_path', 'page_number']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('annotations');
|
|
}
|
|
}
|