我试图通过迁移将列添加到特定的表。目标是添加包含枚举值的数组的列类型
1次尝试:
await queryInterface.addColumn(
'Locations',
'tags',
{
type: Sequelize.ARRAY(Sequelize.ENUM({
values: ['Competitor', 'Multi Location', 'Duplicate']
})),
}
);
***结果:***ERROR: type "public.enum_Locations_tags[]" does not exist
2次尝试:
await queryInterface.sequelize.query("CREATE TYPE enum_Locations_tags AS ENUM ('Competitor', 'Multi Location', 'Duplicate');");
await queryInterface.addColumn(
'Locations',
'tags',
{
type: Sequelize.ARRAY(Sequelize.ENUM({
values: ['Competitor', 'Multi Location', 'Duplicate']
})),
}
);
***结果:***ERROR: type "public.enum_Locations_tags[]" does not exist
任何想法如何解决这个问题,提前感谢!
1条答案
按热度按时间5lhxktic1#