我正在使用Laravel 5.7和PostgreSQL构建一个站点。问题是:
是
Schema::table('the_table', function (Blueprint $table) {
$table->index(['column1', 'column2'], 'the_index', 'the_method')
});
等同于
CREATE INDEX the_index ON the_table USING the_method ((ARRAY[column1, column2]));
?
如果没有,是否有办法用Eloquent?
答案 0 :(得分:0)
使用原始表达式和algorithm()
:
Schema::table('the_table', function (Blueprint $table) {
$table->index([DB::raw('(ARRAY[column1, column2])')], 'the_index')->algorithm('btree');
});