أُنشئ من Tokal/Test
Fix API reliability and CORS config for hosted deployment
هذا الالتزام موجود في:
@@ -0,0 +1,28 @@
|
||||
<?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
|
||||
{
|
||||
if (Schema::hasTable('user_feedback')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('user_feedback', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
|
||||
$table->text('message');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
$table->timestamp('updated_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_feedback');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
if (! Schema::hasTable('user_feedback') || ! Schema::hasColumn('user_feedback', 'user_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::statement('ALTER TABLE user_feedback ALTER COLUMN user_id DROP NOT NULL');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (! Schema::hasTable('user_feedback') || ! Schema::hasColumn('user_feedback', 'user_id')) {
|
||||
return;
|
||||
}
|
||||
|
||||
DB::table('user_feedback')->whereNull('user_id')->delete();
|
||||
DB::statement('ALTER TABLE user_feedback ALTER COLUMN user_id SET NOT NULL');
|
||||
}
|
||||
};
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم