Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Using SQL ORMs with Node.js Defining Models Use Options to Adjust Models

Updating table models & names or creating new tables.

Looking to clear up some confusion on my end.

When making changes to the model options - for example, setting the tableName -

  { 
     tableName: 'my_movies_table', 
     sequelize 
   });

when I run the app, a new table with the tableName is created. Previous tables are stored and exist until manually deleted. Future app runs update the tableName table only.

If this the correct behavior or am I missing something? I thought the following code deleted existing tables and recreate tables on each app run.

 await db.sequelize.sync({ force: true })

I spent way too much time not understanding why my table wasn't being updated until I realized I was looking at the wrong table...