我正在尝试更改表中的列以将knex枚举修改为本机类型,以受益于Postgres的绑定系统,当我执行迁移时,我得到此错误类型"request_type" already exists
,您知道这里发生了什么吗?] >
export async function up(knex: Knex): Promise<any> {
return knex.schema.alterTable('appointments', table => {
table.enu('type', ['video', 'physical'], { useNative: true, enumName: 'request_type' }).alter();
});
}
export async function down(knex: Knex): Promise<any> {
return knex.schema
.alterTable('appointments', table => {
table.dropColumn('type');
})
.then(() => knex.raw('CREATE TYPE request_type AS ENUM("video", "physical")'))
.then(() => knex.raw('drop type request_type'));
}
我正在尝试更改表中的列以将knex枚举修改为本机类型,以受益于Postgres的绑定系统,当我执行迁移时,我已经收到此错误类型“ request_type”了...]]
好像在knex中有一个bug,当更改这样的列时,它会导致创建类型查询被添加两次。