CreateEpisodesTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 22 1
A down() 0 6 1
1
<?php
2
3
namespace CosmicRadioTV\Podcast\updates;
4
5
use DB;
6
use Illuminate\Database\Schema\Blueprint;
7
use October\Rain\Database\Updates\Migration;
8
use Schema;
9
10
class CreateEpisodesTable extends Migration
11
{
12
13
    /**
14
     * Migration
15
     */
16
    public function up()
17
    {
18
        DB::transaction(function () {
19
            Schema::create('cosmicradiotv_podcast_episodes', function (Blueprint $table) {
20
                $table->engine = 'InnoDB';
21
                $table->increments('id');
22
                $table->unsignedInteger('show_id');
23
                $table->string('title');
24
                $table->string('slug');
25
                $table->text('summary')->nullable();
26
                $table->text('content')->nullable();
27
                $table->integer('length');
28
                $table->dateTime('release')->nullable();
29
                $table->boolean('published')->default(false);
30
                $table->timestamps();
31
32
                $table->foreign('show_id')->references('id')->on('cosmicradiotv_podcast_shows')
33
                      ->onUpdate('cascade');
34
                $table->unique(['show_id', 'slug']);
35
            });
36
        });
37
    }
38
39
    /**
40
     * Rollback
41
     */
42
    public function down()
43
    {
44
        DB::transaction(function () {
45
            Schema::drop('cosmicradiotv_podcast_episodes');
46
        });
47
    }
48
}