Skip to content

bug: enum name image will generate BLOB #674

Open
@bobby169

Description

CREATE TABLE `asset_list` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `type` enum('video','audio','image') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'video',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

static initModel(sequelize: Sequelize.Sequelize): typeof asset_list {
return sequelize.define(
'asset_list',
{
id: {
autoIncrement: true,
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
primaryKey: true,
},
type: {
type: DataTypes.BLOB, // this is error
allowNull: false,
defaultValue: 'video',
},

When I change sql to the following:

CREATE TABLE `asset_list` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `type` enum('video','audio','img') CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT 'video',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

Rename the image to img, and the data generated is correct.

static initModel(sequelize: Sequelize.Sequelize): typeof asset_list {
return sequelize.define(
'asset_list',
{
id: {
autoIncrement: true,
type: DataTypes.INTEGER.UNSIGNED,
allowNull: false,
primaryKey: true,
},
type: {
type: DataTypes.ENUM('video', 'audio', 'img'),
allowNull: false,
defaultValue: 'video',
},

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions