0

I have updated my table name (from 'StaffMembers' to 'staff' )before running sequelize migration and created a table in postgres db with new name successfully. but when i try to insert a user sequelize still refer old tabel name.

Executing (default): INSERT INTO "StaffMembers" ("id","firstName","lastName","email","password

I expect updated table name in "INSERT INTO" command i.e "staff" instead of "StaffMember"

  • Got code to share? I suspect you need to update the field in your model -- but without seeing anything you're working with just guessing – Alvin Sep 10 '19 at 23:02

1 Answers1

0

Issue must be in your model definition

sequelize.define(
  'StaffMembers', // <------- Check in your model definition
  {
    ...
  }
);

Solution:

sequelize.define(
  'staff', // <------- Change that line to this
  {
    ...
  }
);
Vivek Doshi
  • 56,649
  • 12
  • 110
  • 122
  • that's what i did but its not working. Sequelize still uses "Staffmembers" as model name during execution even after changing model name in model /migration file – Rahul Dhingra Sep 14 '19 at 07:47