Untitled
unknown
plain_text
a year ago
829 B
21
Indexable
<?php
use App\Models\Model\Entity;
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('entity_properties', function (Blueprint $table) {
$table->dropForeign(['entity_id']);
$table->dropColumn('entity_id');
$table->morphs('propertiesable');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('entity_properties', function (Blueprint $table) {
$table->dropMorphs('propertiesable');
$table->foreignIdFor(Entity::class, 'entity_id')->constrained('entities');
});
}
};
Editor is loading...
Leave a Comment