<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AttachHitColumns extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('albums', function (Blueprint $table) {
            $table->bigInteger('hits')->default(0);
        });

        Schema::table('photos', function (Blueprint $table) {
            $table->bigInteger('hits')->default(0);
            $table->bigInteger('hits_download')->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('photos', function (Blueprint $table) {
            $table->dropColumn('hits_download');
            $table->dropColumn('hits');
        });

        Schema::table('albums', function (Blueprint $table) {
            $table->dropColumn('hits');
        });
    }
}