Add Deck + pivot tables
parent
b18d98ae81
commit
8c7ef7c187
@ -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('cards_tags', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBiginteger('cards_id')->unsigned();
|
||||
$table->unsignedBiginteger('tags_id')->unsigned();
|
||||
|
||||
$table->foreign('cards_id')->references('id')->on('cards')->onDelete('cascade');
|
||||
$table->foreign('tags_id')->references('id')->on('tags')->onDelete('cascade');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cards_tags');
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue