Rubén Jiménez
Rubén Jiménez

Reputation: 1845

Using Sequelize along with ActiveRecord

I'm working on a project in which we have a main website developed using RoR and, in the other hand, we have a NodeJS server receiving/sending information. Both platforms use the same MySQL database, and it has been created, configured and designed using ActiveRecord from RoR.

Right now, i have the need to play with the database (also at the same time with RoR) from NodeJS and i was thinking about using Sequelize. It occurs to me that there could be some kind of problem using the same database from two different ORMs.

Besides, I want Sequelize to access the data and adding new data, but i don't want Sequelize to modify the structure or the scheme. The database scheme must be managed/modified by RoR, not by Sequelize.

Is this possible? I've seen in Sequelize official documentation i gotta define each model programmatically, but i don't know if these model definitions are going to try to modify the current scheme in database.

Is there any other way to accomplish this better?

Upvotes: 0

Views: 777

Answers (1)

Ryan Endacott
Ryan Endacott

Reputation: 9172

From my understanding, it looks like Sequelize will only modify your tables if you call model.sync();. So you should be able to define and use the models, just be sure to not sync them.

Upvotes: 1

Related Questions