Skip to content

Sequelize database field mapping not working #2602

@ChrisCrank211

Description

@ChrisCrank211

I’m having a problem in Sequelize that causes the column names and JSON object properties to not match up. This mostly manifests on create and update.

First, here’s how my data model looks:
https://www.dropbox.com/s/9yfiqvl69v57hyk/Screenshot%202014-11-21%2010.24.16.png?dl=0

When I do a create, it stores the data object but returns both the aliased JSON properties and the actual database column names:
https://www.dropbox.com/s/w3i1rycav6pfib0/Screenshot%202014-11-21%2010.22.29.png?dl=0

When I do an update, it breaks because it doesn’t translate the column names at all and can’t find the aliased JSON properties in the database:
https://www.dropbox.com/s/ah3vmibj0ooo1ly/Screenshot%202014-11-21%2010.23.22.png?dl=0

This is in Sequelize 2.0.0 with both Postgres and MySql.

If you have any idea or suggestion around this, please let me know, otherwise we have to resort to 1-to-1 mapping of JSON object property names and database column names.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugDEPRECATED: replace with the "bug" issue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions