TDD with Jest and sequelize - POSTGRES Migration error for SQLITE

Asked

Viewed 14 times

0

I am implementing TDD with Jest in a Node with express application, my database is POSTGRES and I have several sequelize Migrations already configured, and for my test scenarios I am running these same Migrations with SQLITE dialect. The problem is that in one of these migration files I run an instruction to delete an ENUM in postgres:

queryInterface.sequelize.query('DROP TYPE IF EXISTS "enum_user_role";');

And with that I’m gaining the following error while executing the instruction "NODE_ENV=test sequelize db:migrate":

ERROR: SQLITE_ERROR: near "TYPE": syntax error

This instruction does not exist in SQLITE, so how can I solve this problem in my unit tests without affecting the Migrations of my postgres production flock?

Someone’s been through it?

  • these quotes must be giving the error, remove it: DROP TYPE IF EXISTS enum_user_role

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.