Answers for "laravel migration create index"

0

laravel dropIndex

Schema::table('geo', function (Blueprint $table) {
    $table->dropIndex(['state']); // Drops index 'geo_state_index'
});
Posted by: Guest on July-28-2020
0

laravel migration index

$table->index(['account_id', 'created_at']);
Posted by: Guest on May-08-2020
2

laravel make migration

php artisan make:migration CreateUsersTable
Posted by: Guest on May-04-2020
0

add index in Laravel migration

<?php

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

class Products extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->string('product_name')->index('product_name');
            $table->string('product_sku')->index('product_sku');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('products');
    }
}
Posted by: Guest on June-15-2021

Code answers related to "laravel migration create index"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language