curated jobs and tags

This commit is contained in:
Doar Mihai
2026-04-04 20:37:35 +03:00
parent feb964f3f6
commit adca106244
10 changed files with 282 additions and 4 deletions
@@ -0,0 +1,31 @@
<?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('tags', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('slug')->unique();
$table->timestamps();
$table->index('slug');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('tags');
}
};
@@ -0,0 +1,30 @@
<?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::table('jobs', function (Blueprint $table) {
$table->boolean('is_curated')->default(false)->after('remote_allowed');
$table->index('is_curated');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('jobs', function (Blueprint $table) {
$table->dropIndex(['is_curated']);
$table->dropColumn('is_curated');
});
}
};
@@ -0,0 +1,33 @@
<?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('job_tag', function (Blueprint $table) {
$table->id();
$table->foreignId('job_id')->constrained()->onDelete('cascade');
$table->foreignId('tag_id')->constrained()->onDelete('cascade');
$table->timestamps();
$table->unique(['job_id', 'tag_id']);
$table->index('job_id');
$table->index('tag_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('job_tag');
}
};