<?php namespace RainLab\User\Updates;

use Schema;
use October\Rain\Database\Updates\Migration;

class UsersAddIpAddress extends Migration
{
    public function up()
    {
        Schema::table('users', function($table)
        {
            $table->string('tiktok')->nullable();
            $table->string('instagram')->nullable();
            $table->string('site')->nullable();
            $table->string('qr')->nullable();
        });
    }

    public function down()
    {
        if (Schema::hasColumn('users', 'tiktok')) {
            Schema::table('users', function($table) {
                $table->dropColumn('tiktok');
            });
        }

        if (Schema::hasColumn('users', 'instagram')) {
            Schema::table('users', function($table) {
                $table->dropColumn('instagram');
            });
        }


        if (Schema::hasColumn('users', 'site')) {
            Schema::table('users', function($table) {
                $table->dropColumn('site');
            });
        }

        if (Schema::hasColumn('users', 'qr')) {
            Schema::table('users', function($table) {
                $table->dropColumn('qr');
            });
        }
    }
}
