AddStandardRssFields::down()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3143
cc 1
eloc 14
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 AddStandardRssFields extends Migration
11
{
12
13
    /**
14
     * Migration
15
     */
16
    public function up()
17
    {
18
        DB::transaction(function () {
19
            Schema::table('cosmicradiotv_podcast_shows', function (Blueprint $table) {
20
                $table->string('feed_language')->default('en-us')->after('description');
21
                $table->string('feed_copyright')->nullable()->after('feed_language');
22
                $table->string('feed_author')->nullable()->after('feed_copyright');
23
                $table->text('itunes_category')->nullable()->after('feed_author');
24
                $table->boolean('itunes_explicit')->nullable()->after('itunes_category');
25
                $table->string('itunes_owner_name')->nullable()->after('itunes_explicit');
26
                $table->string('itunes_owner_email')->nullable()->after('itunes_owner_name');
27
            });
28
            Schema::table('cosmicradiotv_podcast_episodes', function (Blueprint $table) {
29
                $table->boolean('itunes_explicit')->nullable()->after('published');
30
            });
31
        });
32
    }
33
34
    /**
35
     * Rollback
36
     */
37
    public function down()
38
    {
39
        DB::transaction(function () {
40
            Schema::table('cosmicradiotv_podcast_shows', function (Blueprint $table) {
41
                $table->dropColumn([
42
                    'feed_language',
43
                    'feed_copyright',
44
                    'feed_author',
45
                    'itunes_category',
46
                    'itunes_explicit',
47
                    'itunes_owner_name',
48
                    'itunes_owner_email',
49
                ]);
50
            });
51
            Schema::table('cosmicradiotv_podcast_episodes', function (Blueprint $table) {
52
                $table->dropColumn([
53
                    'itunes_explicit',
54
                ]);
55
            });
56
        });
57
    }
58
59
}