Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop sequelize create table

Every time I call a page, sequelize execute: CREATE TABLE IF NOT EXISTS `user_p...

How can I disable this? the table is created and works fine, I no need sequelize try to create every time.

like image 727
David Avatar asked Mar 12 '14 18:03

David


People also ask

Does Sequelize automatically create table?

Automatically creates tables in MySQL database if they don't exist by calling await sequelize.

How do you initialize Sequelize?

The init() method requires you to pass a sequelize instance where the Model will be attached to. You also need to provide the modelName option to name the model when you're not extending the Model class. A Sequelize Model can also be initialized using the sequelize.

What is DB Sequelize sync ()?

The Sequelize instance method sync() is used to synchronize your Sequelize model with your database tables. The synchronization happens at the table level.

How do you create a Sequelized model?

Sequelize set up Install Sequelize database driver for the database you would like to use by running one of the commands below. Install npm package Sequelize-CLI. Create a project folder. In your project folder path, run the command below to initialize Sequelize in the folder.


1 Answers

Sequelize is doing this, because you either defined a many-to-many association between two models that don't have the option syncOnAssociation set to false or you call sequelize.sync somewhere.

Check this http://sequelizejs.com/docs/latest/usage#block-4-line-56

like image 163
sdepold Avatar answered Nov 03 '22 00:11

sdepold