1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

[AC-10362] Remove OrganizationUser.AccessAll from code (#4622)

* Remove OrganizationUser.AccessAll from code

* Add shadow property

* Remove remaining reference

* dotnet format

* Fix tests

* Bump migration dates
This commit is contained in:
Thomas Rittson
2024-08-26 21:03:44 +10:00
committed by GitHub
parent 78beac9f19
commit 22bd755b3c
21 changed files with 8249 additions and 159 deletions

View File

@ -0,0 +1,45 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class OrganizationUserAccessAllDefaultValue : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_OrganizationUser_UserId_OrganizationId_Status",
table: "OrganizationUser");
migrationBuilder.AlterColumn<bool>(
name: "AccessAll",
table: "OrganizationUser",
type: "boolean",
nullable: false,
defaultValue: false,
oldClrType: typeof(bool),
oldType: "boolean");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<bool>(
name: "AccessAll",
table: "OrganizationUser",
type: "boolean",
nullable: false,
oldClrType: typeof(bool),
oldType: "boolean",
oldDefaultValue: false);
migrationBuilder.CreateIndex(
name: "IX_OrganizationUser_UserId_OrganizationId_Status",
table: "OrganizationUser",
columns: new[] { "UserId", "OrganizationId", "Status" })
.Annotation("Npgsql:IndexInclude", new[] { "AccessAll" });
}
}

View File

@ -1233,7 +1233,9 @@ namespace Bit.PostgresMigrations.Migrations
.HasColumnType("uuid");
b.Property<bool>("AccessAll")
.HasColumnType("boolean");
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<bool>("AccessSecretsManager")
.HasColumnType("boolean");
@ -1281,11 +1283,6 @@ namespace Bit.PostgresMigrations.Migrations
b.HasIndex("UserId")
.HasAnnotation("SqlServer:Clustered", false);
b.HasIndex("UserId", "OrganizationId", "Status")
.HasAnnotation("SqlServer:Clustered", false);
NpgsqlIndexBuilderExtensions.IncludeProperties(b.HasIndex("UserId", "OrganizationId", "Status"), new[] { "AccessAll" });
b.ToTable("OrganizationUser", (string)null);
});