<?php

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

class CreateUsersProfilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users_profiles', function (Blueprint $table) {
            $table->id();
            $table->uuid('uuid')->index('uuid');
            $table->uuid('user_uuid')->index('user_uuid');
            $table->dateTime('created_at');
            $table->uuid('created_uuid')->index('created_uuid');
            $table->dateTime('updated_at');
            $table->uuid('updated_uuid')->index('updated_uuid');
            $table->char('language', 5)->default('en');
            $table->boolean('invisible')->default(0);
            $table->string('usertitle', 255)->nullable();
            $table->string('avatar', 255)->nullable();
            $table->text('signature')->nullable();
            $table->string('website', 255)->nullable();
            $table->string('skype', 255)->nullable();
            $table->dateTime('birthday')->nullable();
            $table->tinyInteger('birthday_privacy')->unsigned()->default(0);
            $table->boolean('birthday_greeting')->default(1);
            $table->boolean('receive_messages')->default(1);
            $table->boolean('show_avatars')->default(1);
            $table->boolean('show_signatures')->default(1);
            $table->tinyInteger('posts_per_page')->unsigned()->default(15);
            $table->tinyInteger('threads_per_page')->unsigned()->default(15);
            $table->char('dateformat', 50)->default('Y-m-d');
            $table->char('timeformat', 50)->default('H:i');
            $table->char('timezone', 50)->default('UTC');
            $table->boolean('dst')->default(0);
            $table->tinyInteger('dstcorrection')->default(0);
            $table->text('notes')->nullable();
            $table->bigInteger('uploaded')->unsigned()->default(0);
            $table->bigInteger('downloaded')->unsigned()->default(0);
            $table->double('ratio')->unsigned()->default(0);
            $table->boolean('can_download')->default(1);
            $table->boolean('can_upload')->default(1);
            $table->tinyInteger('waiting_time')->unsigned()->default(0);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users_profiles');
    }
}
