Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mulit-Tenant] tenantSettings table in backend #3127

Open
2 tasks done
Tracked by #2893
njlie opened this issue Nov 22, 2024 · 2 comments · May be fixed by #3137
Open
2 tasks done
Tracked by #2893

[Mulit-Tenant] tenantSettings table in backend #3127

njlie opened this issue Nov 22, 2024 · 2 comments · May be fixed by #3137
Assignees
Labels
pkg: backend Changes in the backend package.

Comments

@njlie
Copy link
Contributor

njlie commented Nov 22, 2024

With the introduction of mulit-tenancy, some environment variables will have to be come tenanted. To represent the tenancy of these variables, the tenantSettings table will hold them. The unique id of rows on this table will not be generated, but will instead be a concatenation of the tenantId it is for and the name of the value it represents. For example:

// tenant id is colon-separated from the key of the variable the row represents
id: "1234-1234-1234:ExchangeRatesUrl"

The tenant settings table schema should look like this:

enum TenantSetting {
  ExchangeRatesUrl
  WebhookUrl
}

TenantSettings {
  id: string // Uses the pattern in above code snippet
  key: TenantSetting
  value: string
}
  • Create migration for tenantSettings table
  • Create model.ts file for tenantSettings table

Prerequisites

@njlie njlie added the pkg: backend Changes in the backend package. label Nov 22, 2024
@github-project-automation github-project-automation bot moved this to Backlog in Rafiki Nov 22, 2024
@njlie njlie mentioned this issue Nov 22, 2024
38 tasks
@njlie njlie moved this from Backlog to Todo in Rafiki Nov 25, 2024
@mkurapov
Copy link
Contributor

mkurapov commented Nov 26, 2024

@njlie the unique id - could we instead use a composite key (tenantId, TenantSetting) as the primary key (without needing another id)?

@golobitch golobitch linked a pull request Nov 26, 2024 that will close this issue
6 tasks
@golobitch golobitch moved this from Todo to In Progress in Rafiki Nov 26, 2024
@njlie
Copy link
Contributor Author

njlie commented Dec 6, 2024

@njlie the unique id - could we instead use a composite key (tenantId, TenantSetting) as the primary key (without needing another id)?

Late response, but that's the idea, this composite key would indeed be the primary key.

@golobitch golobitch added this to the Multi Tenant v1 milestone Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: backend Changes in the backend package.
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

3 participants