I'm trying to work out a way to use a single model to "shard" data that I'm importing from different customers' business systems. For example, let's say I'm pulling down basic employee information where my schema might be something like:
guid: string // A GUID that I generate to link with other tables
name: string // The name of the employee
login: string // Their login on their corporate system
Now it's trivial to create a model and a table to store that, but let's say I need to keep my different customers completely separate (I could use a customerId field in the table, but I don't want any risk of data collision), so my database names might look like:
company1_guid_login_map
company2_guid_login_map
Where each table is just a clone of the original model.
Is there any way I can create just one Sequelize model where I can dynamically change the table name depending on what customer's information I'm working on?
Thanks in advance.
Regards,
Andrew Eddie