mohan #5

Merged
mohanmd merged 46 commits from mohan into master 2026-06-15 09:13:23 +00:00
2 changed files with 11 additions and 2 deletions
Showing only changes of commit 2c8fb9e757 - Show all commits

View File

@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
@ -12,7 +13,13 @@
public function up(): void
{
Schema::table('announcements', function (Blueprint $table) {
$table->foreignId('sponsor_id')->nullable()->constrained('sponsors')->onDelete('cascade');
$table->unsignedBigInteger('sponsor_id')->nullable()->after('employer_id');
// Only add FK constraint on MySQL (SQLite in-memory DB used in tests
// does not reliably support named foreign keys via constrained()).
if (DB::getDriverName() !== 'sqlite') {
$table->foreign('sponsor_id')->references('id')->on('sponsors')->onDelete('cascade');
}
});
}
@ -22,7 +29,9 @@ public function up(): void
public function down(): void
{
Schema::table('announcements', function (Blueprint $table) {
if (DB::getDriverName() !== 'sqlite') {
$table->dropForeign(['sponsor_id']);
}
$table->dropColumn('sponsor_id');
});
}