Generated migration imports failing
What you are doing?
I am trying to generate a model that has a migration with it
import {
QueryInterface,
SequelizeStatic,
} from 'sequelize';
export = {
up: (queryInterface: QueryInterface, Sequelize: SequelizeStatic) => {
return queryInterface.createTable('Devices', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
deviceName: {
type: Sequelize.STRING
},
imei: {
type: Sequelize.STRING
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
down: (queryInterface: QueryInterface, Sequelize: SequelizeStatic) => {
return queryInterface.dropTable('Devices');
}
};
What do you expect to happen?
I expected SequelizeStatic to be working and to be declared
What is actually happening?
However, SequelizeStatic apparently doesn't exist, why is that?
Image of the error
Module '"../../node_modules/sequelize/types"' has no exported member 'SequelizeStatic'.ts(2305)
Dialect: mysql / postgres / sqlite / mssql / any
Database version: 9.5
Sequelize CLI version: 3.2.0-c
Sequelize version: 5.22.3
I'm running into the same error.
@types/[email protected] [email protected] [email protected] [email protected] [email protected]
Same error.
@types/sequelize 4.28.9 typescript 4.2.4 sequelize 6.6.2 sequelize-cli-typescript 3.2.0c pg 8.6.0
@krlicmuhamed @marlongerson @fredcy which do you have used to create a migration in typescript. I have tried the sequelize-cli migration:generate --name=sys-user but it does not work. It failed and throw me an error of invalid arguments.
Following is my .sequelizerc.
const path = require('path');
module.exports = {
config: path.resolve("dist", "config", "db.config.js"),
"models-path": path.resolve("src", "orm", "models"),
'migrations-source-path': path.resolve('src', 'orm', 'migrations'),
'migrations-compiled-path': path.resolve('dist', 'orm', 'migrations'),
'seeders-source-path': path.resolve('src', 'orm', 'seeders'),
'seeders-compiled-path': path.resolve('dist', 'orm', 'seeders'),
};
Can anyone put some light on my issue?