<?php

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

class CreateArtistsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('artists', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique() ;
            $table->string('slug') ;
            $table->timestamps();
        });

        // Full Text Index (MySQL only, skipped for SQLite)
        if (config('database.default') !== 'sqlite') {
            DB::statement('ALTER TABLE artists ADD FULLTEXT fulltext_index (name)');
        }
    }

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