sequelize / cli

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

SequelizeMeta structure incompatible with SingleStore/memsql #1397

Open jsking216 opened 11 months ago

jsking216 commented 11 months ago

What you are doing?

The table schema for the SequelizeMeta table is in conflict with the memsql/SingleStore dbms. The problematic query is the following table create:

CREATE TABLE IF NOT EXISTS `SequelizeMeta` (`name` VARCHAR(255) NOT NULL UNIQUE , PRIMARY KEY (`name`));

which causes an error due to validation on the memsql side with name being the PK and also defined as UNIQUE explicitly

SQL Error [1706] [HY000]: Feature 'Multiple HASH indices on the same columns' is not supported by 
SingleStore.

simply skipping the explicit UNIQUE constraint on name avoids this issue

CREATE TABLE IF NOT EXISTS `SequelizeMeta` (`name` VARCHAR(255) NOT NULL , PRIMARY KEY (`name`));

Is there any reason not to remove the unique flag in the table definition? It is theoretically extraneous since it is the PK already.

What do you expect to happen?

I would expect the SequelizeMeta table to initialize successfully without intervention - or for there to be a way to configure my way out of the problem.

What is actually happening?

Error is being thrown due to validation on the dbms being confused that the key is also manually defined as unique.

SQL Error [1706] [HY000]: Feature 'Multiple HASH indices on the same columns' is not supported by 
SingleStore.

Dialect: memsql/SingleStore Database version: 8.1 Sequelize CLI version: 5.5.1 Sequelize version: 6.17.0

WikiRik commented 11 months ago

A quick workaround is to remove this line locally; https://github.com/sequelize/cli/blob/a2526ed0090bcd55eaeeb0179f79ea6e09cd1a84/src/core/migrator.js#L132

We officially do not support memsql/SingleStore btw. What dialect did you use in the sequelize config?

jsking216 commented 11 months ago

A quick workaround is to remove this line locally;

https://github.com/sequelize/cli/blob/a2526ed0090bcd55eaeeb0179f79ea6e09cd1a84/src/core/migrator.js#L132

We officially do not support memsql/SingleStore btw. What dialect did you use in the sequelize config?

We are using mysql dialect w/ sequelize.

Since you don't officially support it, we may be able to ask the SingleStore team to support a flag instead.