sequelize/sequelize — pull request #1952 by quiddle (2014-06-23 16:29:01+00:00)
Title: Pass options to getTableName function

I work with a few databases that use tables names based on their parent ID. I don't want to generate unique sequelize models for each one- it would be a waste of resources. Instead, I made this small change to the code, overrode the getTableName function in the classMethods, added the logic needed to generate the correct table names and passed the needed values in with the options.

A simplified database example:

# Table *account*
id | name
---|---
1 | Arthur's Towels
2 | Ford's Library

# Table *customers_1*
id | email
---|---
1 | fenchurch@yahoo.co.milkyway
2 | zaphod@sirius.star

# Table *customers_2*
id | email
---|---
1 | trillian@mcmillian.zz9
2 | zaphod@sirius.star