I'm trying to stick with Sequelize because I've already gotten it halfway set up. But I haven't deployed anything so I'm open to switching if anyone can confirm that Sequelize isn't the way to go.I'm trying to set up a model, and in their documentation they say that adding the force: true option will drop the table if it already exists. Is there something I'm missing? My preference would be that this skip over the creation of a table if that table already exists. Wouldn't dropping the table get rid of it?// force: true will drop the table if it already exists User.sync({force: true}).then(() => { // Table created return User.create({ firstName: 'John', lastName: 'Hancock' }); });Edit: I already figured it out by playing with it. It was just confusing because their documentation is what I would call "super vague", so for them to throw the option of force: true at you -- of all things to make sure you knew -- seemed strange to me. Yes, it drops the table if that table has already been created. The part that confuses me all the time is when there are multiple options for doing something and the writer has listed them in close proximity without explaining when he/she is changing options, or which code belongs to which preference.
Submitted December 10, 2018 at 12:30AM by michaellaw_
No comments:
Post a Comment