Skip to content

Add DETAIL to migration error output #1138

@snewcomer

Description

@snewcomer

Ref code:

console.error(`${clc.red('ERROR:')} ${message}`);

Currently an error logs the message property of the "ERROR".

    console.error(`${_cliColor2.default.red('ERROR:')} ${message}`);

In the case of an error, you get something like

SequelizeForeignKeyConstraintError: insert or update on table "my_table" violates foreign key constraint "...."

We could log the "DETAIL" similar to Postgres log_error_verbosity configuration.

    console.error(`${_cliColor2.default.red('ERROR:')} ${message}`);
    console.error(`${_cliColor2.default.red('DETAIL:')} ${error.original.detail}`);

This would greatly help with debugging migration issues with sequelize.

Logging more detailed output could expose security implications in the normal course of operations for an application. However, for migrations, I don't know if we have this concern. Thoughts?

What do you expect to happen?

ERROR: SequelizeForeignKeyConstraintError: insert or update on table "my_table" violates foreign key constraint "...."
DETAIL: Key (my_column)=(1) is not present in table "my_table"

What is actually happening?

ERROR: SequelizeForeignKeyConstraintError: insert or update on table "my_table" violates foreign key constraint "...."

Dialect:__ postgres (and others)
Database version: N/A
Sequelize CLI version: most recent
Sequelize version: N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions