mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
36 lines
969 B
PHP
36 lines
969 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
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
|
|
{
|
|
if (! Schema::hasTable('resourceables')) {
|
|
Schema::create('resourceables', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('resource_id');
|
|
$table->foreign('resource_id')->references('resource_id')->on('resources')->cascadeOnDelete();
|
|
|
|
$table->morphs('resourceable');
|
|
$table->string('as')->nullable();
|
|
|
|
$table->timestamps(6);
|
|
|
|
$table->unique([
|
|
'resource_id',
|
|
'resourceable_type',
|
|
'resourceable_id',
|
|
], 'resourceable_unique');
|
|
});
|
|
}
|
|
}
|
|
};
|