58 lines
2.3 KiB
PHP
58 lines
2.3 KiB
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('jobs', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->string('external_id')->nullable();
|
|
$table->string('title');
|
|
$table->string('company');
|
|
$table->text('description');
|
|
$table->string('location')->nullable();
|
|
$table->decimal('salary_min', 10, 2)->nullable();
|
|
$table->decimal('salary_max', 10, 2)->nullable();
|
|
$table->string('salary_currency', 3)->nullable()->default('USD');
|
|
$table->enum('job_type', ['full-time', 'part-time', 'contract', 'temporary', 'internship', 'freelance'])->nullable();
|
|
$table->foreignId('job_source_id')->constrained('job_sources')->onDelete('cascade');
|
|
$table->string('source_url')->nullable();
|
|
$table->string('apply_url')->nullable();
|
|
$table->timestamp('posted_at')->nullable();
|
|
$table->timestamp('expires_at')->nullable();
|
|
$table->boolean('remote_allowed')->default(false);
|
|
$table->enum('experience_level', ['entry', 'mid', 'senior', 'lead', 'executive'])->nullable();
|
|
$table->foreignId('job_category_id')->nullable()->constrained('job_categories')->onDelete('set null');
|
|
$table->foreignId('job_location_id')->nullable()->constrained('job_locations')->onDelete('set null');
|
|
$table->string('fingerprint')->nullable()->unique();
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
|
|
$table->index(['job_source_id', 'external_id']);
|
|
$table->index('posted_at');
|
|
$table->index('expires_at');
|
|
$table->index('job_type');
|
|
$table->index('experience_level');
|
|
$table->index('remote_allowed');
|
|
$table->index('job_category_id');
|
|
$table->index('job_location_id');
|
|
$table->fullText(['title', 'company', 'description']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('jobs');
|
|
}
|
|
};
|