sequelize / cli

The Sequelize CLI
MIT License
2.53k stars 525 forks source link

Can't drop a column in a migration #1256

Open Roguyt opened 1 year ago

Roguyt commented 1 year ago

What you are doing?

'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
    async up(queryInterface, Sequelize) {
        await queryInterface.removeColumn('user', 'id_Sage', {
            logging: (sql) => console.error(sql),
        });
    },

    async down(queryInterface, Sequelize) {
        return false;
    },
};

What do you expect to happen?

I expected the column to be dropped

What is actually happening?

An error occurs which prevents me from migrating my DB

▶ yarn run db:migrate
yarn run v1.22.19
$ sequelize db:migrate

Sequelize CLI [Node: 18.14.0, CLI: 6.6.0, ORM: 6.6.5]

Loaded configuration file "libs/db/src/config/database/index.js".
Using environment "development".
== 20230224101241-remove-idSage-from-user: migrating =======
Executing (default): SELECT CONSTRAINT_NAME as constraint_name,CONSTRAINT_NAME as constraintName,CONSTRAINT_SCHEMA as constraintSchema,CONSTRAINT_SCHEMA as constraintCatalog,TABLE_NAME as tableName,TABLE_SCHEMA as tableSchema,TABLE_SCHEMA as tableCatalog,COLUMN_NAME as columnName,REFERENCED_TABLE_SCHEMA as referencedTableSchema,REFERENCED_TABLE_SCHEMA as referencedTableCatalog,REFERENCED_TABLE_NAME as referencedTableName,REFERENCED_COLUMN_NAME as referencedColumnName FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE (REFERENCED_TABLE_NAME = 'user' AND REFERENCED_TABLE_SCHEMA = 'database' AND REFERENCED_COLUMN_NAME = 'id_Sage') OR (TABLE_NAME = 'user' AND TABLE_SCHEMA = 'database' AND COLUMN_NAME = 'id_Sage' AND REFERENCED_TABLE_NAME IS NOT NULL)

ERROR: Cannot delete property 'meta' of [object Array]

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Dialect: mysql/mariadb Database version: 10.7 Sequelize CLI version: 6.6.0 Sequelize version: 6.6.5

jalog commented 1 year ago

I got the same ERROR.

WikiRik commented 1 year ago

Which version of the mariadb connector are you using? Sequelize v6 does not support v3 of the mariadb connector