mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[SM-713] Add database support for secret access policies (#3681)
* mssql add column and migration * Add secret access policies to EF models and config * Clear new access policies on service account delete * Add SM cleanup code on delete * Fix EF org user bulk delete * Run EF migrations
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.SqliteMigrations.Migrations;
|
||||
|
||||
/// <inheritdoc />
|
||||
public partial class AddSecretAccessPolicies : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "GrantedSecretId",
|
||||
table: "AccessPolicy",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_AccessPolicy_GrantedSecretId",
|
||||
table: "AccessPolicy",
|
||||
column: "GrantedSecretId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_AccessPolicy_Secret_GrantedSecretId",
|
||||
table: "AccessPolicy",
|
||||
column: "GrantedSecretId",
|
||||
principalTable: "Secret",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_AccessPolicy_Secret_GrantedSecretId",
|
||||
table: "AccessPolicy");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_AccessPolicy_GrantedSecretId",
|
||||
table: "AccessPolicy");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GrantedSecretId",
|
||||
table: "AccessPolicy");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user