blue-twilight/database/migrations/2017_04_16_095657_attach_hit_columns.php

43 lines
993 B
PHP
Raw Permalink Normal View History

<?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');
});
}
}