Skip to content

PostgreSQL: sequelize sync hangs within transaction when ENUM field exists #3782

@tornillo

Description

@tornillo

TYPE queries are executed outside of the transaction.

var User = sequelize.define('User', {
    type: Sequelize.ENUM('a', 'b')
});

sequelize.transaction()
.then(function (tx) {
    return sequelize.sync({
        force: true,
        transaction: tx
    })
})
.then(function () {
    tx.commit();
});

SQL log:

Executing (814aa406-47f7-405e-be52-620304464fdc): START TRANSACTION;
Executing (814aa406-47f7-405e-be52-620304464fdc): SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
Executing (814aa406-47f7-405e-be52-620304464fdc): SET autocommit = 1;
Executing (814aa406-47f7-405e-be52-620304464fdc): DROP TABLE IF EXISTS "Users" CASCADE;
Executing (default): DROP TYPE IF EXISTS "enum_Users_type";
<-- hangs here with "default"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions