0

I'm using TypeScript and trying to drop a single enum using the function specified in the API Reference here:

https://sequelize.org/api/v6/class/src/dialects/postgres/query-interface.js~postgresqueryinterface#instance-method-dropEnum

Yet I get the TypeScript error:

Property 'dropEnum' does not exist on type 'QueryInterface'.

Code snippet:

export const down: Migration = async ({ context: queryInterface }) => {
  ...
  await queryInterface.dropEnum(); // Error here
};

I tried updating sequelize & sequelize-typescript, but I still get the same error.

EDIT

Until I know what I'm doing wrong/This gets fixed you can use this:

export const down: Migration = async ({ context: queryInterface }) => {
  await queryInterface.dropTable('<table_name>', {});
  await queryInterface.sequelize.query(
    'DROP TYPE IF EXISTS enum_<enum_name>'
  );
};
Noriel
  • 1
  • 1

0 Answers0