Add multitenancy to allow multiple bots per DB #311
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The idea of this change is to allow you to be able to host multiple bots on a single database - a change likely to benefit those who are building platforms around SuperScript.
Description
Now, if you want to use multitenancy, you can do:
If you don't want to use multitenancy, simply don't include it in the options when setting up SuperScript, and then instead of an instance,
setupwill provide you with a bot in the 'master' tenancy.Under the hood, all the models/db and fact system connections are shared between bots as part of an instance, so getting a new bot is really fast and virtually no cost.
You can still have multiple instances referencing completely different databases, and each instance can have bots that are multitenanted or not (i.e. share a database or not). So you can still do:
Motivation and Context
This addresses certain concerns like #287 and #288.
How Has This Been Tested?
This needs unit tests to ensure that you can't accidentally populate from a different tenancy. Need to do this before merge.
Types of changes
Checklist: