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

Can't drop a column in a migration #1256

Open
Roguyt opened this issue Feb 24, 2023 · 2 comments
Open

Can't drop a column in a migration #1256

Roguyt opened this issue Feb 24, 2023 · 2 comments

Comments

@Roguyt
Copy link

Roguyt commented Feb 24, 2023

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
Copy link

jalog commented Oct 31, 2023

I got the same ERROR.

@WikiRik
Copy link
Member

WikiRik commented Oct 31, 2023

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

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

3 participants