Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class constructor cannot be invoked without new #78

Open
kaykhancheckpoint opened this issue Jun 9, 2020 · 0 comments
Open

Class constructor cannot be invoked without new #78

kaykhancheckpoint opened this issue Jun 9, 2020 · 0 comments

Comments

@kaykhancheckpoint
Copy link

I am using sequalize and I'm trying to run auto migrations with the following library: https://github.com/flexxnn/sequelize-auto-migrations with NODE_ENV=development npx sequelize-auto-migrations --name initial but i get the following error:

Class constructor Authentication cannot be invoked without 'new'

const Sequelize = require('sequelize');
const sequelize = require('../../config/database');
const { serializeModel } = require('../utils/serializeRelationships');
const { Op } = require('sequelize');

const hooks = {};

const tableName = 'authentication';

const defaultScope = {};

class Authentication extends Sequelize.Model {}

Authentication.init({
    id: {
        type: Sequelize.UUID,
        primaryKey: true,
    },
    dType: {
        type: Sequelize.STRING,
        field: 'dtype',
    },
    serviceId: {
        type: Sequelize.STRING,
        field: 'service_id',
    },
    session: {
        type: Sequelize.STRING,
    },
    createdAt: {
        type: Sequelize.DATE,
        field: 'created_at',
    },
    updatedAt: {
        type: Sequelize.DATE,
        field: 'updated_at',
    },
}, {
    sequelize, defaultScope, scopes: {}, hooks, tableName, timestamps: true,
});


Authentication.prototype.toJSON = function toJSON() {
    return serializeModel(this);
};

module.exports = Authentication;

node: v12.16.3

Im not using babel or anything else.

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

No branches or pull requests

1 participant