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');
});
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)')]);
});
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community