It would be great if sequelize-cli supports migrations in ESM way.
What you are doing?
// db/migrations/20220924162319-create-test.js
export async function up(queryInterface, Sequelize) {
await queryInterface.createTable('test', {
id: {
type: Sequelize.DataTypes.INTEGER,
allowNull: false,
autoIncrement: true,
primaryKey: true,
},
createdAt: {
allowNull: false,
type: Sequelize.DataTypes.DATE,
},
updatedAt: {
allowNull: false,
type: Sequelize.DataTypes.DATE,
}
});
}
export function down(queryInterface, Sequelize) {
return queryInterface.dropTable('test');
}
What do you expect to happen?
Migration works.
What is actually happening?
npx sequelize db:migrate
Sequelize CLI [Node: 16.16.0, CLI: 6.4.1, ORM: 6.23.0]
Loaded configuration file "db/config.js".
== 20220924162319-create-test: migrating =======
ERROR: require() of ES Module /test/db/migrations/20220924162319-create-test.js from /test/node_modules/umzug/lib/migration.js not supported.
Instead change the require of 20220924162319-create-test.js in /test/node_modules/umzug/lib/migration.js to a dynamic import() which is available in all CommonJS modules.
Output, either JSON or SQL
Dialect: postgres
Database version: 12
Sequelize CLI version: 6.4.1
Sequelize version: 6.23.0
It would be great if
sequelize-clisupports migrations in ESM way.What you are doing?
What do you expect to happen?
Migration works.
What is actually happening?
Output, either JSON or SQL
Dialect: postgres
Database version: 12
Sequelize CLI version: 6.4.1
Sequelize version: 6.23.0