Vault DB のリレーション定義です。Drizzle ORM v1.0 beta の Relations V2 (defineRelations) を使用しています。
| 親テーブル | 子テーブル | リレーション名 | FK |
|---|
| user | session | sessions | session.userId → user.id |
| user | account | accounts | account.userId → user.id |
| user | apikey | apikeys | apikey.userId → user.id |
| user | passkey | passkeys | passkey.userId → user.id |
| user | member | members | member.userId → user.id |
| user | invitation | invitations | invitation.inviterId → user.id |
| user | oauthApplication | oauthApplications | oauthApplication.userId → user.id |
| user | oauthAccessToken | oauthAccessTokens | oauthAccessToken.userId → user.id |
| user | oauthConsent | oauthConsents | oauthConsent.userId → user.id |
| user | outerMail | outerMails | outerMail.userId → user.id |
| user | outerPhone | outerPhones | outerPhone.userId → user.id |
| organization | member | members | member.organizationId → organization.id |
| organization | invitation | invitations | invitation.organizationId → organization.id |
| organization | organizationRole | roles | organizationRole.organizationId → organization.id |
| organization | organization | children | organization.parentId → organization.id |
| member | memberRole | orgRoles | memberRole.memberId → member.id |
| organizationRole | memberRole | members | memberRole.roleId → organizationRole.id |
| oauthApplication | oauthAccessToken | accessTokens | oauthAccessToken.clientId → oauthApplication.clientId |
| oauthApplication | oauthConsent | consents | oauthConsent.clientId → oauthApplication.clientId |
| テーブル | リレーション名 | FK | 説明 |
|---|
| organization | parent | organization.parentId → organization.id | 親組織(自己参照) |
| 子テーブル | 親テーブル | リレーション名 | FK |
|---|
| session | user | user | session.userId → user.id |
| account | user | user | account.userId → user.id |
| apikey | user | user | apikey.userId → user.id |
| passkey | user | user | passkey.userId → user.id |
| member | organization | organization | member.organizationId → organization.id |
| member | user | user | member.userId → user.id |
| organizationRole | organization | organization | organizationRole.organizationId → organization.id |
| memberRole | member | member | memberRole.memberId → member.id |
| memberRole | organizationRole | role | memberRole.roleId → organizationRole.id |
| invitation | organization | organization | invitation.organizationId → organization.id |
| invitation | user | inviter | invitation.inviterId → user.id |
| outerMail | user | user | outerMail.userId → user.id |
| outerPhone | user | user | outerPhone.userId → user.id |
| oauthAccessToken | oauthApplication | application | oauthAccessToken.clientId → oauthApplication.clientId |
| oauthAccessToken | user | user | oauthAccessToken.userId → user.id |
| oauthConsent | oauthApplication | application | oauthConsent.clientId → oauthApplication.clientId |
| oauthConsent | user | user | oauthConsent.userId → user.id |