Skip to content

Commit

Permalink
Network as many Tvs
Browse files Browse the repository at this point in the history
  • Loading branch information
murdercode committed Jan 20, 2022
1 parent 78e6538 commit 2e5ef8d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions database/migrations/2022_01_20_121500_create_network_tv_table.php
@@ -0,0 +1,25 @@
<?php

use Astrotomic\Tmdb\Models\Network;
use Astrotomic\Tmdb\Models\Tv;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class() extends Migration
{
public function up(): void
{
Schema::connection(Tv::connection())->create('network_tv', static function (Blueprint $table): void {
$table->foreignId('tv_id')->constrained(Tv::table());
$table->foreignId('network_id')->constrained(Network::table());

$table->unique(['tv_id', 'network_id']);
});
}

public function down(): void
{
Schema::connection(Tv::connection())->dropIfExists('network_tv');
}
};

0 comments on commit 2e5ef8d

Please sign in to comment.