有没有办法在Knex.js模式中指定多列索引?或者必须下降到raw并执行alter table
发布于 2014-04-10 09:25:38
我想通了。您可以直接在表上使用.index链接器,并传递索引字段的数组和索引的名称。
knex.schema.createTable(function(table) {
table.bigInteger('_id').unsigned().primary();
table.string('fieldA');
table.string('fieldB');
table.index(['fieldA','fieldB'], 'index_name');
});https://stackoverflow.com/questions/22362801
复制相似问题