Estou com duvidas de como resolver esse erro "Error: Values for ENUM have not been defined." Rodei o comando par criar a tabela mas sem sucesso :/
node api/banco-de-dados/criarTabelas.js
meu codigo api-petshop\api\rotas\fornecedores
const Sequelize = require("sequelize");
const instancia = require('../../banco-de-dados');// declarando nossa instancia
const colunas = {
empresa: {
type: Sequelize.STRING,
allowNull: false
},
email: {
type: Sequelize.STRING,
allowNull: false
},
categoria: {
type: Sequelize.ENUM,
value: ('racao', 'brinquedos'),
allowNull: false
}
}
const opcoes = {
freezeTableName: true,
tableName: 'fornecedores',
timestamps: true,
createdAt: 'dataCriacao',
updatedAt: 'dataAtualizacao',
version: 'versao'
}
module.exports = instancia.define('fornecedor', colunas, opcoes)
ERRO:
C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop>node api/banco-de-dados/criarTabelas.js
C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\sequelize\lib\sequelize.js:553
throw new Error("Values for ENUM have not been defined.");
^
Error: Values for ENUM have not been defined.
at Sequelize.normalizeAttribute (C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\sequelize\lib\sequelize.js:553:15)
at C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\sequelize\lib\model.js:726:34
at C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\lodash\lodash.js:13469:38
at C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\lodash\lodash.js:4967:15 at baseForOwn (C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\lodash\lodash.js:3032:24)
at Function.mapValues (C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\lodash\lodash.js:13468:7)
at Function.init (C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\sequelize\lib\model.js:725:28)
at Sequelize.define (C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\node_modules\sequelize\lib\sequelize.js:219:11)
at Object.<anonymous> (C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop\api\rotas\fornecedores\ModeloTabelaFornecedor.js:29:28)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
C:\Users\Caique\Desktop\Estudos\REST API ESCALAVEL\api-petshop>