Prefix support in Sequelize.js
Asked Answered
C

1

7

Is there any way to support prefixed tables names when using Sequelize.js ?

Imagine I wanted to build a blogging platform so that each registered user would get his own blog and URL (subdomain). Now if one opens userxxx.mydomain.com he should get content from tables named userxxx_TABLENAME while opening difuser.mydomain.com would fetch data from difuser_TABLENAME etc.

I tried adding prefixes to models names eg: sequelize.define('userxxx_Post' ...) which could work but creates mess when it comes to many-to-many relations (table names become userxxx_Postuserxxx_Comment).

Is there any better way?

(I'm not exactly building a blogging platform on node.js but solution to this problem will be the same)

Coss answered 23/8, 2012 at 15:59 Comment(0)
G
0

Probably you need tableName option?

From docs

Grumpy answered 14/7, 2014 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.