0

As I'm new to sequelize, and I have the following question:

When I start my application, it automatically creates tables based on my model definitions, is there a way to prevent this from happening?

I want to use my migration script to create the tables, and I do not want to have to drop the tables in my migration script if the application was run prior to running the migration scripts.

KevinC
  • 115
  • 1
  • 1
  • 8

1 Answers1

0

I think you are talking about the sequelize sync function. This will create the databases if they don't exist. If you force it to true sequelize.sync({force: true}), it will delete all your schema and create everything again. It is very useful on testing, but I'd say rather dangerous in production. For instance, if you have a project with some migration scripts and then init your project using the sync, your migration scripts will fail because the tables where already created by the sync function. Just get rid of the sync and you should be fine.

Edudjr
  • 1,676
  • 18
  • 28