Skip to content

Commit

Permalink
feat: add foreign keys for keysPermissions
Browse files Browse the repository at this point in the history
  • Loading branch information
chronark committed Jan 27, 2024
1 parent 53d1fd6 commit 6c516c3
Show file tree
Hide file tree
Showing 2 changed files with 3,837 additions and 1,368 deletions.
8 changes: 6 additions & 2 deletions internal/db/src/schema/rbac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ export const keysPermissions = mysqlTable(
"keys_permissions",
{
keyId: varchar("key_id", { length: 256 }).notNull(),
permissionId: varchar("permission_id", { length: 256 }).notNull(),
workspaceId: varchar("workspace_id", { length: 256 }).notNull(),
permissionId: varchar("permission_id", { length: 256 })
.notNull()
.references(() => permissions.id, { onDelete: "cascade" }),
workspaceId: varchar("workspace_id", { length: 256 })
.notNull()
.references(() => workspaces.id, { onDelete: "cascade" }),
},
(table) => ({
pk: primaryKey({ columns: [table.keyId, table.permissionId] }),
Expand Down
Loading

0 comments on commit 6c516c3

Please sign in to comment.