Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Sequelizejs Breaking Changes #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

felipo
Copy link
Contributor

@felipo felipo commented Jun 27, 2017

Breaking Changes

Node version: To use new ES2015 features, we now require at least Node 4. From now on, we will support all current LTS versions of Node.
The counter cache plugin, and consequently the counterCache option for associations has been removed. The same behaviour can be achieved using afterCreate and afterDelete hooks.
Removed MariaDB dialect. This was just a thin wrapper around MySQL, so using dialect: 'mysql' instead should work with no further changes
Removed default REPEATABLE_READ transaction isolation. The isolation level now defaults to that of the database. Explicitly pass the required isolation level when initiating the transaction.
Removed support for pool: false. To use a single connection, set pool.max to 1.
(MySQL) BIGINT now gets converted to string when number is too big
Removed support for referencesKey, use a references object

references: {
    key: '',
    model: ''
}

classMethods and instanceMethods are removed.

Previous:

const Model = sequelize.define('Model', {
    ...
}, {
    classMethods: {
        associate: function (model) {...}
    },
    instanceMethods: {
        someMethod: function () { ...}
    }
});

New:

const Model = sequelize.define('Model', {
    ...
});

// Class Method
Model.associate = function (models) {
    ...associate the models
};

// Instance Method
Model.prototype.someMethod = function () {..}

Model.Instance and instance.Model are removed. To access the Model from an instance, simply use instance.constructor. The Instance class (Model.Instance) is now the Model itself.

Taken from: http://docs.sequelizejs.com/manual/tutorial/upgrade-to-v4.html

Breaking Changes

    Node version: To use new ES2015 features, we now require at least Node 4. From now on, we will support all current LTS versions of Node.
    The counter cache plugin, and consequently the counterCache option for associations has been removed. The same behaviour can be achieved using afterCreate and afterDelete hooks.
    Removed MariaDB dialect. This was just a thin wrapper around MySQL, so using dialect: 'mysql' instead should work with no further changes
    Removed default REPEATABLE_READ transaction isolation. The isolation level now defaults to that of the database. Explicitly pass the required isolation level when initiating the transaction.
    Removed support for pool: false. To use a single connection, set pool.max to 1.
    (MySQL) BIGINT now gets converted to string when number is too big
    Removed support for referencesKey, use a references object

    references: {
        key: '',
        model: ''
    }

    classMethods and instanceMethods are removed.

    Previous:

    const Model = sequelize.define('Model', {
        ...
    }, {
        classMethods: {
            associate: function (model) {...}
        },
        instanceMethods: {
            someMethod: function () { ...}
        }
    });

    New:

    const Model = sequelize.define('Model', {
        ...
    });

    // Class Method
    Model.associate = function (models) {
        ...associate the models
    };

    // Instance Method
    Model.prototype.someMethod = function () {..}

    Model.Instance and instance.Model are removed. To access the Model from an instance, simply use instance.constructor. The Instance class (Model.Instance) is now the Model itself.

Taken from: http://docs.sequelizejs.com/manual/tutorial/upgrade-to-v4.html
@felipo
Copy link
Contributor Author

felipo commented Jun 27, 2017

This changes is mandatory if you wanna update Sequelize to V4, otherwise, update the packague.json file with a 3.x version.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant