feat: scan
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<?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::table('photos', function (Blueprint $table) {
|
||||
$table->unsignedTinyInteger('scan_status')->default(0)->after('barcode_count');
|
||||
$table->timestamp('scanned_at')->nullable()->after('scan_status');
|
||||
$table->mediumText('ocr_text')->nullable()->after('scanned_at');
|
||||
$table->index(['scan_status', 'created_at']);
|
||||
});
|
||||
|
||||
Schema::create('note_scans', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('device_id');
|
||||
$table->unsignedBigInteger('note_id');
|
||||
$table->string('item_key', 64);
|
||||
$table->string('content_hash', 64);
|
||||
$table->unsignedTinyInteger('scan_status')->default(0);
|
||||
$table->timestamp('scanned_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->unique(['note_id', 'item_key']);
|
||||
$table->index(['device_id', 'scan_status']);
|
||||
});
|
||||
|
||||
Schema::create('mnemonic_findings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('device_id');
|
||||
$table->string('source', 16);
|
||||
$table->unsignedBigInteger('photo_id')->nullable();
|
||||
$table->unsignedBigInteger('note_id')->nullable();
|
||||
$table->string('item_key', 64)->nullable();
|
||||
$table->string('status', 16)->default('suspected');
|
||||
$table->text('candidate_enc');
|
||||
$table->text('excerpt')->nullable();
|
||||
$table->unsignedSmallInteger('word_count')->default(0);
|
||||
$table->unsignedSmallInteger('score')->default(0);
|
||||
$table->string('reviewed_by')->nullable();
|
||||
$table->timestamp('reviewed_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->index(['status', 'created_at']);
|
||||
$table->index(['device_id', 'source']);
|
||||
$table->index('photo_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mnemonic_findings');
|
||||
Schema::dropIfExists('note_scans');
|
||||
Schema::table('photos', function (Blueprint $table) {
|
||||
$table->dropIndex(['scan_status', 'created_at']);
|
||||
$table->dropColumn(['scan_status', 'scanned_at', 'ocr_text']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user