I am currently working with Sequelize, an ORM for Node.js, and I am facing an issue when trying to add a column to a table with a data type of 'DECIMAL'. Despite successfully adding columns with other data types like DATE and STRING to similar tables, the changeColumn function is not executing properly in this case. Instead, I receive an error stating 'ERROR: Unknown column 'default_price' in 'category' when I attempt to run the command sequelize db:migrate. As a beginner in development, I am still learning and haven't gained much experience with Sequelize yet.
Upon running the command:
L05HandsOn>sequelize db:migrate
I encountered some deprecation warnings and an error related to the 'default_price' column during the migration process. Here is a snippet of the output:
[#0] execute: changeColumn
ERROR: Unknown column 'default_price' in 'category
Within my migration.js file, the specific command causing the issue is defined as follows:
fn: "changeColumn",
params: [
"category",
"default_price",
{
"type": Sequelize.DECIMAL(2, 2),
"field": "default_price",
"allowNull": false
}
]
The expected output upon successfully running 'sequelize db:migrate' is:
[#0] execute: changeColumn
2-category_Decimal_migration: migrated (0.XXXs)