balderdashy / balderdashy/sails

Switch Datastore Dynamically After Sails Lift

Open
#6,934 10 comments 0 reactions 0 assignees View on GitHub
more info please orm question
Dominant language
JavaScript
Stars
22.8k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

**Node version**: v10.16.0
**Sails version** _(sails)_: 1.2.3
**ORM hook version** _(sails-hook-orm)_: 2.1.1
**Sockets hook version** _(sails-hook-sockets)_: 2.0.0
**Organics hook version** _(sails-hook-organics)_: 1.0.0
**Grunt hook version** _(sails-hook-grunt)_: 4.0.1
**Uploads hook version** _(sails-hook-uploads)_: 0.4.3
**DB adapter & version** _(e.g. sails-mysql@5.55.5)_: sails-mysql@1.0.1
**Skipper adapter & version** _(e.g. skipper-s3@5.55.5)_: skipper-s3@0.6.0


Hello,

I want to create a multi tenancy with my own method.
I have this idea, which is checking a datastore owned by current user then pass it to sails.config or process.env variable. Then I've tried to use the datastore passed to sails.config or process.env in the datastore model definition. but it failed because it's not switching the datastore.
I have another idea to switch the datastore in controller, However I have no idea how to do that?
Or Can it actually switch the datastore dynamically in the model definition after sails lift?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the datastore model definition, controller usage, and the sails.config or process.env values mentioned in the issue. Determine whether a datastore can be selected dynamically after Sails lifts, and define the supported multi-tenancy behavior or limitation. The issue is complete only when the behavior and implementation path are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.