【发布时间】:2021-12-08 23:04:43
【问题描述】:
我正在尝试使用 knex js 索引 created_at 和 updated_at 列 但是当我分配 index() 时,它显示了这个错误:
类型“void”上不存在属性“index”
await knex.schema.createTable('ontario_user_reports', (table) => {
table.string('user_id').notNullable().index();
table.timestamps(false, true).index(); // here
table.string('type').notNullable().index();
});
你能给我一个正确的方法来索引 created_at 吗?
【问题讨论】:
标签: javascript node.js typescript postgresql knex.js