Using Sequelize.js, Node.js, and PostgreSQL.
When trying to force sync the models to the database (drop everything, create everything) I receive errors on the types created for any enum fields.
Example:
{
[error: cannot drop type "enum_Availabilities_status" because other objects depend on it]
length: 304,
name: 'error',
severity: 'ERROR',
code: '2BP01',
detail: 'table "Availabilities" column status depends on type "enum_Availabilities_status"',
hint: 'Use DROP ... CASCADE to drop the dependent objects too.',
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
file: 'src\\backend\\catalog\\dependency.c',
line: '951',
routine: 'reportDependentObjects'
}
This appears after executing:
sequelize.sync({ force: true })
Any suggestions on how to get around this?
I can't tell you how the ORM does things, but you could force this first by dropping to SQL and issuing the following:
DROP TYPE IF EXISTS enum_Availabilities_status CASCADE;
My guess is that the CASCADE is missing from the SQL call. Then resync.
Please try this on a copy of your database first. I am not 100% sure what will happen if you already have a type in the column.