-
Notifications
You must be signed in to change notification settings - Fork 880
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2458 from meetcshah19/meet/eng-1443-add-groups-as…
…-eligible-approvers feat: allow access approvals with user groups
- Loading branch information
Showing
23 changed files
with
728 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
backend/src/db/migrations/20240918005344_add-group-approvals.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Knex } from "knex"; | ||
|
||
import { TableName } from "../schemas"; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
if (await knex.schema.hasTable(TableName.AccessApprovalPolicyApprover)) { | ||
// add column approverGroupId to AccessApprovalPolicyApprover | ||
await knex.schema.alterTable(TableName.AccessApprovalPolicyApprover, (table) => { | ||
// make nullable | ||
table.uuid("approverGroupId").nullable().references("id").inTable(TableName.Groups).onDelete("CASCADE"); | ||
// make approverUserId nullable | ||
table.uuid("approverUserId").nullable().alter(); | ||
}); | ||
// add column approverGroupId to SecretApprovalPolicyApprover | ||
await knex.schema.alterTable(TableName.SecretApprovalPolicyApprover, (table) => { | ||
table.uuid("approverGroupId").references("id").inTable(TableName.Groups).onDelete("CASCADE"); | ||
table.uuid("approverUserId").nullable().alter(); | ||
}); | ||
} | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
if (await knex.schema.hasTable(TableName.AccessApprovalPolicyApprover)) { | ||
// remove | ||
await knex.schema.alterTable(TableName.AccessApprovalPolicyApprover, (table) => { | ||
table.dropColumn("approverGroupId"); | ||
table.uuid("approverUserId").notNullable().alter(); | ||
}); | ||
|
||
// remove | ||
await knex.schema.alterTable(TableName.SecretApprovalPolicyApprover, (table) => { | ||
table.dropColumn("approverGroupId"); | ||
table.uuid("approverUserId").notNullable().alter(); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.