citusdata / citusdata/citus_docs

Multi-tenant migration steps for Sequelize ORM

Open
#536 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
CSS
Stars
58
Forks
60
PR merge metrics
No merged PRs in 30d

Description

## Why are we implementing it? (sales eng)
There are a couple of customers/prospects who use SEQUELIZE.

### What are the typical use cases?
Multi-tenant use cases.

## Communication goals (e.g. detailed howto vs orientation)
* Model (schema) changes to add tenant_id to tables and constraints.
* How to make queries have tenant_id appended? ORMs can already have constructs (for ex. composite primary keys, scopes in sequelize etc) which would filters to tenant_id to DMLS and selects. We need to investigate by spinning up a demo app and do a test.

### Good locations for content in docs structure
https://docs.citusdata.com/en/v7.0/migration/transitioning.html#app-migration

### Example code snippet:
1) Supports composite primary keys by which tenant_id automatically gets added to DMLs (updates, inserts).
2) By using the concept of defaultScope as in this [link](https://medium.com/@adhasmana/how-we-implemented-multi-tenancy-in-our-node-js-app-cf9a2515969b) we can add tenant_id to single-model and queries with associations.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.