AddNullableToReleaseEpisode::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 11
rs 9.4286
cc 1
eloc 5
nc 1
nop 0
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 AddNullableToReleaseEpisode extends Migration
11
{
12
13
    /**
14
     * Migration
15
     */
16
    public function up()
17
    {
18
        DB::transaction(function () {
19
            // Clean up all current bindings
20
            \October\Rain\Database\Models\DeferredBinding::cleanUp(0);
21
22
            Schema::table('cosmicradiotv_podcast_releases', function (Blueprint $table) {
23
                $table->unsignedInteger('episode_id')->nullable()->change();
24
            });
25
        });
26
    }
27
28
    /**
29
     * Rollback
30
     */
31
    public function down()
32
    {
33
        DB::transaction(function () {
34
            // Clean up all current bindings
35
            \October\Rain\Database\Models\DeferredBinding::cleanUp(0);
36
37
            Schema::table('cosmicradiotv_podcast_releases', function (Blueprint $table) {
38
                $table->unsignedInteger('episode_id')->change();
39
            });
40
        });
41
42
    }
43
}