Sequelize db:migrate error

Asked

Viewed 228 times

0

Hello! I have a DB Postgres running perfectly on my machine. I can create my Migrations, for example in the following command:

npx sequelize migration:create --name=create-users

I am trying to run a migrate, but is returning the following error:

inserir a descrição da imagem aqui

Follow the Migration code:

'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('users', { 
        id: {
            type: Sequelize.INTEGER,
            primatyKey: true,
            autoIncrement: true,
            allowNull: false
        },
        name: {
            type: Sequelize.STRING,
            allowNull: false
        },
        email: {
            type: Selection.STRING,
            allowNull: false
        },
        password: {
            type: Selection.STRING,
            allowNull: false
        },
        created_at: {
            type: Sequelize.DATE,
            allowNull: false
        },
        updated_at: {
            type: Selection.DATE,
            allowNull: false
        }
    });
},
down: (queryInterface, Sequelize) => {
        return queryInterface.dropTable('users');
}

};

Does anyone have any idea what I’m doing wrong?

1 answer

0


Are you identifying the type as Selection, the correct is Sequelize

Example:

return queryInterface.createTable('users', { 
    id: {
        type: Sequelize.INTEGER,
        primatyKey: true,
        autoIncrement: true,
        allowNull: false
    },
    name: {
        type: Sequelize.STRING,
        allowNull: false
    },
    email: {
        type: Sequelize.STRING,
        allowNull: false
    },
    password: {
        type: Sequelize.STRING,
        allowNull: false
    },
    created_at: {
        type: Sequelize.DATE,
        allowNull: false
    },
    updated_at: {
        type: Sequelize.DATE,
        allowNull: false
    }
});

See the types available on documentation.

  • Putz... Thanks Rafael Tavares. My lack of attention. Thanks!

Browser other questions tagged

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