Support the ongoing development of Laravel.io →
posted 8 years ago
Database
Last updated 2 years ago.
0

Copied from http://stackoverflow.com/questions/24792974/laravel-4-migrations-schema-index-length

..create these indexes manually using DB::statement(); in your migration.

In your up() do something like this

DB::statement('CREATE INDEX description_idx ON Customers (description(100));');

And then in your down() you can simply

Schema::table('Customers', function($table) {
    $table->dropIndex('description_idx');
});
0

You can use DB::raw() as well

public function up()
{
    Schema::table('Customers', function($table) {
        $table->index([DB::raw('description(100)')]);
    });
}
public function down()
{
    Schema::table('Customers', function($table) {
        $table->dropIndex([DB::raw('description(100)')]);
    });
}
0

Sign in to participate in this thread!

Eventy

Your banner here too?

crlcu crlcu Joined 4 Feb 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.