1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

[PM-10365] Drop OrganizationUser AccessAll (#4701)

* Remove OrganizationUser.AccessAll

* Final database migrations
This commit is contained in:
Thomas Rittson 2024-09-24 16:26:35 +10:00 committed by GitHub
parent 02fee8c1e9
commit f7bc5dfb2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 8918 additions and 127 deletions

View File

@ -105,10 +105,7 @@ public class DatabaseContext : DbContext
var eOrganizationDomain = builder.Entity<OrganizationDomain>(); var eOrganizationDomain = builder.Entity<OrganizationDomain>();
var aWebAuthnCredential = builder.Entity<WebAuthnCredential>(); var aWebAuthnCredential = builder.Entity<WebAuthnCredential>();
// Shadow property configurations // Shadow property configurations go here
builder.Entity<OrganizationUser>()
.Property<bool>("AccessAll")
.HasDefaultValue(false);
eCipher.Property(c => c.Id).ValueGeneratedNever(); eCipher.Property(c => c.Id).ValueGeneratedNever();
eCollection.Property(c => c.Id).ValueGeneratedNever(); eCollection.Property(c => c.Id).ValueGeneratedNever();

View File

@ -6,7 +6,6 @@
@Key VARCHAR(MAX), @Key VARCHAR(MAX),
@Status SMALLINT, @Status SMALLINT,
@Type TINYINT, @Type TINYINT,
@AccessAll BIT = 0,
@ExternalId NVARCHAR(300), @ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7), @CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7), @RevisionDate DATETIME2(7),
@ -26,7 +25,6 @@ BEGIN
[Key], [Key],
[Status], [Status],
[Type], [Type],
[AccessAll],
[ExternalId], [ExternalId],
[CreationDate], [CreationDate],
[RevisionDate], [RevisionDate],
@ -43,7 +41,6 @@ BEGIN
@Key, @Key,
@Status, @Status,
@Type, @Type,
@AccessAll,
@ExternalId, @ExternalId,
@CreationDate, @CreationDate,
@RevisionDate, @RevisionDate,

View File

@ -13,7 +13,6 @@ BEGIN
[Key], [Key],
[Status], [Status],
[Type], [Type],
[AccessAll],
[ExternalId], [ExternalId],
[CreationDate], [CreationDate],
[RevisionDate], [RevisionDate],
@ -29,7 +28,6 @@ BEGIN
OUI.[Key], OUI.[Key],
OUI.[Status], OUI.[Status],
OUI.[Type], OUI.[Type],
0, -- AccessAll will be removed shortly
OUI.[ExternalId], OUI.[ExternalId],
OUI.[CreationDate], OUI.[CreationDate],
OUI.[RevisionDate], OUI.[RevisionDate],

View File

@ -1,42 +0,0 @@
CREATE PROCEDURE [dbo].[OrganizationUser_CreateMany2]
@OrganizationUsersInput [dbo].[OrganizationUserType2] READONLY
AS
BEGIN
SET NOCOUNT ON
INSERT INTO [dbo].[OrganizationUser]
(
[Id],
[OrganizationId],
[UserId],
[Email],
[Key],
[Status],
[Type],
[AccessAll],
[ExternalId],
[CreationDate],
[RevisionDate],
[Permissions],
[ResetPasswordKey],
[AccessSecretsManager]
)
SELECT
OU.[Id],
OU.[OrganizationId],
OU.[UserId],
OU.[Email],
OU.[Key],
OU.[Status],
OU.[Type],
OU.[AccessAll],
OU.[ExternalId],
OU.[CreationDate],
OU.[RevisionDate],
OU.[Permissions],
OU.[ResetPasswordKey],
OU.[AccessSecretsManager]
FROM
@OrganizationUsersInput OU
END
GO

View File

@ -6,7 +6,6 @@ CREATE PROCEDURE [dbo].[OrganizationUser_CreateWithCollections]
@Key VARCHAR(MAX), @Key VARCHAR(MAX),
@Status SMALLINT, @Status SMALLINT,
@Type TINYINT, @Type TINYINT,
@AccessAll BIT = 0,
@ExternalId NVARCHAR(300), @ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7), @CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7), @RevisionDate DATETIME2(7),
@ -18,7 +17,7 @@ AS
BEGIN BEGIN
SET NOCOUNT ON SET NOCOUNT ON
EXEC [dbo].[OrganizationUser_Create] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager EXEC [dbo].[OrganizationUser_Create] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager
;WITH [AvailableCollectionsCTE] AS( ;WITH [AvailableCollectionsCTE] AS(
SELECT SELECT

View File

@ -6,7 +6,6 @@
@Key VARCHAR(MAX), @Key VARCHAR(MAX),
@Status SMALLINT, @Status SMALLINT,
@Type TINYINT, @Type TINYINT,
@AccessAll BIT = 0,
@ExternalId NVARCHAR(300), @ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7), @CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7), @RevisionDate DATETIME2(7),
@ -26,7 +25,6 @@ BEGIN
[Key] = @Key, [Key] = @Key,
[Status] = @Status, [Status] = @Status,
[Type] = @Type, [Type] = @Type,
[AccessAll] = @AccessAll,
[ExternalId] = @ExternalId, [ExternalId] = @ExternalId,
[CreationDate] = @CreationDate, [CreationDate] = @CreationDate,
[RevisionDate] = @RevisionDate, [RevisionDate] = @RevisionDate,

View File

@ -63,7 +63,6 @@ BEGIN
[Key] = OUI.[Key], [Key] = OUI.[Key],
[Status] = OUI.[Status], [Status] = OUI.[Status],
[Type] = OUI.[Type], [Type] = OUI.[Type],
[AccessAll] = 0, -- AccessAll will be removed shortly
[ExternalId] = OUI.[ExternalId], [ExternalId] = OUI.[ExternalId],
[CreationDate] = OUI.[CreationDate], [CreationDate] = OUI.[CreationDate],
[RevisionDate] = OUI.[RevisionDate], [RevisionDate] = OUI.[RevisionDate],

View File

@ -1,34 +0,0 @@
CREATE PROCEDURE [dbo].[OrganizationUser_UpdateMany2]
@OrganizationUsersInput [dbo].[OrganizationUserType2] READONLY
AS
BEGIN
SET NOCOUNT ON
UPDATE
OU
SET
[OrganizationId] = OUI.[OrganizationId],
[UserId] = OUI.[UserId],
[Email] = OUI.[Email],
[Key] = OUI.[Key],
[Status] = OUI.[Status],
[Type] = OUI.[Type],
[AccessAll] = OUI.[AccessAll],
[ExternalId] = OUI.[ExternalId],
[CreationDate] = OUI.[CreationDate],
[RevisionDate] = OUI.[RevisionDate],
[Permissions] = OUI.[Permissions],
[ResetPasswordKey] = OUI.[ResetPasswordKey],
[AccessSecretsManager] = OUI.[AccessSecretsManager]
FROM
[dbo].[OrganizationUser] OU
INNER JOIN
@OrganizationUsersInput OUI ON OU.Id = OUI.Id
EXEC [dbo].[User_BumpManyAccountRevisionDates]
(
SELECT UserId
FROM @OrganizationUsersInput
)
END
GO

View File

@ -6,7 +6,6 @@
@Key VARCHAR(MAX), @Key VARCHAR(MAX),
@Status SMALLINT, @Status SMALLINT,
@Type TINYINT, @Type TINYINT,
@AccessAll BIT = 0,
@ExternalId NVARCHAR(300), @ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7), @CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7), @RevisionDate DATETIME2(7),
@ -18,7 +17,7 @@ AS
BEGIN BEGIN
SET NOCOUNT ON SET NOCOUNT ON
EXEC [dbo].[OrganizationUser_Update] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager EXEC [dbo].[OrganizationUser_Update] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager
-- Update -- Update
UPDATE UPDATE
[Target] [Target]

View File

@ -7,7 +7,6 @@
[ResetPasswordKey] VARCHAR (MAX) NULL, [ResetPasswordKey] VARCHAR (MAX) NULL,
[Status] SMALLINT NOT NULL, [Status] SMALLINT NOT NULL,
[Type] TINYINT NOT NULL, [Type] TINYINT NOT NULL,
[AccessAll] BIT NOT NULL,
[ExternalId] NVARCHAR (300) NULL, [ExternalId] NVARCHAR (300) NULL,
[CreationDate] DATETIME2 (7) NOT NULL, [CreationDate] DATETIME2 (7) NOT NULL,
[RevisionDate] DATETIME2 (7) NOT NULL, [RevisionDate] DATETIME2 (7) NOT NULL,
@ -20,9 +19,8 @@
GO GO
CREATE NONCLUSTERED INDEX [IX_OrganizationUser_UserIdOrganizationIdStatus] CREATE NONCLUSTERED INDEX [IX_OrganizationUser_UserIdOrganizationIdStatusV2]
ON [dbo].[OrganizationUser]([UserId] ASC, [OrganizationId] ASC, [Status] ASC) ON [dbo].[OrganizationUser]([UserId] ASC, [OrganizationId] ASC, [Status] ASC);
INCLUDE ([AccessAll]);
GO GO

View File

@ -1,16 +0,0 @@
CREATE TYPE [dbo].[OrganizationUserType2] AS TABLE(
[Id] UNIQUEIDENTIFIER,
[OrganizationId] UNIQUEIDENTIFIER,
[UserId] UNIQUEIDENTIFIER,
[Email] NVARCHAR(256),
[Key] VARCHAR(MAX),
[Status] SMALLINT,
[Type] TINYINT,
[AccessAll] BIT,
[ExternalId] NVARCHAR(300),
[CreationDate] DATETIME2(7),
[RevisionDate] DATETIME2(7),
[Permissions] NVARCHAR(MAX),
[ResetPasswordKey] VARCHAR(MAX),
[AccessSecretsManager] BIT
)

View File

@ -0,0 +1,11 @@
-- Finalise removal of OrganizationUser.AccessAll column
-- Add default column value
-- Sprocs already have default value for rollback purposes, this just supports dropping the column itself
IF OBJECT_ID('[dbo].[DF_OrganizationUser_AccessAll]', 'D') IS NULL
AND COL_LENGTH('[dbo].[OrganizationUser]', 'AccessAll') IS NOT NULL
BEGIN
ALTER TABLE [dbo].[OrganizationUser]
ADD CONSTRAINT [DF_OrganizationUser_AccessAll] DEFAULT (0) FOR [AccessAll];
END
GO

View File

@ -0,0 +1,399 @@
-- Finalise removal of OrganizationUser.AccessAll column
-- Remove the column from sprocs
-- Drop old sprocs and type
IF OBJECT_ID('[dbo].[OrganizationUser_CreateMany2]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[OrganizationUser_CreateMany2]
END
GO
IF OBJECT_ID('[dbo].[OrganizationUser_UpdateMany2]') IS NOT NULL
BEGIN
DROP PROCEDURE [dbo].[OrganizationUser_UpdateMany2]
END
GO
IF TYPE_ID('[dbo].[OrganizationUserType2]') IS NOT NULL
BEGIN
DROP TYPE [dbo].[OrganizationUserType2]
END
GO
-- Update remaining sprocs
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_Create]
@Id UNIQUEIDENTIFIER OUTPUT,
@OrganizationId UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status SMALLINT,
@Type TINYINT,
@ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@Permissions NVARCHAR(MAX),
@ResetPasswordKey VARCHAR(MAX),
@AccessSecretsManager BIT = 0
AS
BEGIN
SET NOCOUNT ON
INSERT INTO [dbo].[OrganizationUser]
(
[Id],
[OrganizationId],
[UserId],
[Email],
[Key],
[Status],
[Type],
[ExternalId],
[CreationDate],
[RevisionDate],
[Permissions],
[ResetPasswordKey],
[AccessSecretsManager]
)
VALUES
(
@Id,
@OrganizationId,
@UserId,
@Email,
@Key,
@Status,
@Type,
@ExternalId,
@CreationDate,
@RevisionDate,
@Permissions,
@ResetPasswordKey,
@AccessSecretsManager
)
END
GO
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_CreateMany]
@jsonData NVARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON
INSERT INTO [dbo].[OrganizationUser]
(
[Id],
[OrganizationId],
[UserId],
[Email],
[Key],
[Status],
[Type],
[ExternalId],
[CreationDate],
[RevisionDate],
[Permissions],
[ResetPasswordKey],
[AccessSecretsManager]
)
SELECT
OUI.[Id],
OUI.[OrganizationId],
OUI.[UserId],
OUI.[Email],
OUI.[Key],
OUI.[Status],
OUI.[Type],
OUI.[ExternalId],
OUI.[CreationDate],
OUI.[RevisionDate],
OUI.[Permissions],
OUI.[ResetPasswordKey],
OUI.[AccessSecretsManager]
FROM
OPENJSON(@jsonData)
WITH (
[Id] UNIQUEIDENTIFIER '$.Id',
[OrganizationId] UNIQUEIDENTIFIER '$.OrganizationId',
[UserId] UNIQUEIDENTIFIER '$.UserId',
[Email] NVARCHAR(256) '$.Email',
[Key] VARCHAR(MAX) '$.Key',
[Status] SMALLINT '$.Status',
[Type] TINYINT '$.Type',
[ExternalId] NVARCHAR(300) '$.ExternalId',
[CreationDate] DATETIME2(7) '$.CreationDate',
[RevisionDate] DATETIME2(7) '$.RevisionDate',
[Permissions] NVARCHAR (MAX) '$.Permissions',
[ResetPasswordKey] VARCHAR (MAX) '$.ResetPasswordKey',
[AccessSecretsManager] BIT '$.AccessSecretsManager'
) OUI
END
GO
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_CreateWithCollections]
@Id UNIQUEIDENTIFIER,
@OrganizationId UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status SMALLINT,
@Type TINYINT,
@ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@Permissions NVARCHAR(MAX),
@ResetPasswordKey VARCHAR(MAX),
@Collections AS [dbo].[CollectionAccessSelectionType] READONLY,
@AccessSecretsManager BIT = 0
AS
BEGIN
SET NOCOUNT ON
EXEC [dbo].[OrganizationUser_Create] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager
;WITH [AvailableCollectionsCTE] AS(
SELECT
[Id]
FROM
[dbo].[Collection]
WHERE
[OrganizationId] = @OrganizationId
)
INSERT INTO [dbo].[CollectionUser]
(
[CollectionId],
[OrganizationUserId],
[ReadOnly],
[HidePasswords],
[Manage]
)
SELECT
[Id],
@Id,
[ReadOnly],
[HidePasswords],
[Manage]
FROM
@Collections
WHERE
[Id] IN (SELECT [Id] FROM [AvailableCollectionsCTE])
END
GO
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_Update]
@Id UNIQUEIDENTIFIER,
@OrganizationId UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status SMALLINT,
@Type TINYINT,
@ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@Permissions NVARCHAR(MAX),
@ResetPasswordKey VARCHAR(MAX),
@AccessSecretsManager BIT = 0
AS
BEGIN
SET NOCOUNT ON
UPDATE
[dbo].[OrganizationUser]
SET
[OrganizationId] = @OrganizationId,
[UserId] = @UserId,
[Email] = @Email,
[Key] = @Key,
[Status] = @Status,
[Type] = @Type,
[ExternalId] = @ExternalId,
[CreationDate] = @CreationDate,
[RevisionDate] = @RevisionDate,
[Permissions] = @Permissions,
[ResetPasswordKey] = @ResetPasswordKey,
[AccessSecretsManager] = @AccessSecretsManager
WHERE
[Id] = @Id
EXEC [dbo].[User_BumpAccountRevisionDate] @UserId
END
GO
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_UpdateMany]
@jsonData NVARCHAR(MAX)
AS
BEGIN
SET NOCOUNT ON
-- Parse the JSON string
DECLARE @OrganizationUserInput AS TABLE (
[Id] UNIQUEIDENTIFIER,
[OrganizationId] UNIQUEIDENTIFIER,
[UserId] UNIQUEIDENTIFIER,
[Email] NVARCHAR(256),
[Key] VARCHAR(MAX),
[Status] SMALLINT,
[Type] TINYINT,
[ExternalId] NVARCHAR(300),
[CreationDate] DATETIME2(7),
[RevisionDate] DATETIME2(7),
[Permissions] NVARCHAR(MAX),
[ResetPasswordKey] VARCHAR(MAX),
[AccessSecretsManager] BIT
)
INSERT INTO @OrganizationUserInput
SELECT
[Id],
[OrganizationId],
[UserId],
[Email],
[Key],
[Status],
[Type],
[ExternalId],
[CreationDate],
[RevisionDate],
[Permissions],
[ResetPasswordKey],
[AccessSecretsManager]
FROM OPENJSON(@jsonData)
WITH (
[Id] UNIQUEIDENTIFIER '$.Id',
[OrganizationId] UNIQUEIDENTIFIER '$.OrganizationId',
[UserId] UNIQUEIDENTIFIER '$.UserId',
[Email] NVARCHAR(256) '$.Email',
[Key] VARCHAR(MAX) '$.Key',
[Status] SMALLINT '$.Status',
[Type] TINYINT '$.Type',
[ExternalId] NVARCHAR(300) '$.ExternalId',
[CreationDate] DATETIME2(7) '$.CreationDate',
[RevisionDate] DATETIME2(7) '$.RevisionDate',
[Permissions] NVARCHAR (MAX) '$.Permissions',
[ResetPasswordKey] VARCHAR (MAX) '$.ResetPasswordKey',
[AccessSecretsManager] BIT '$.AccessSecretsManager'
)
-- Perform the update
UPDATE
OU
SET
[OrganizationId] = OUI.[OrganizationId],
[UserId] = OUI.[UserId],
[Email] = OUI.[Email],
[Key] = OUI.[Key],
[Status] = OUI.[Status],
[Type] = OUI.[Type],
[ExternalId] = OUI.[ExternalId],
[CreationDate] = OUI.[CreationDate],
[RevisionDate] = OUI.[RevisionDate],
[Permissions] = OUI.[Permissions],
[ResetPasswordKey] = OUI.[ResetPasswordKey],
[AccessSecretsManager] = OUI.[AccessSecretsManager]
FROM
[dbo].[OrganizationUser] OU
INNER JOIN
@OrganizationUserInput OUI ON OU.Id = OUI.Id
-- Bump account revision dates
EXEC [dbo].[User_BumpManyAccountRevisionDates]
(
SELECT [UserId]
FROM @OrganizationUserInput
)
END
GO
CREATE OR ALTER PROCEDURE [dbo].[OrganizationUser_UpdateWithCollections]
@Id UNIQUEIDENTIFIER,
@OrganizationId UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER,
@Email NVARCHAR(256),
@Key VARCHAR(MAX),
@Status SMALLINT,
@Type TINYINT,
@ExternalId NVARCHAR(300),
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@Permissions NVARCHAR(MAX),
@ResetPasswordKey VARCHAR(MAX),
@Collections AS [dbo].[CollectionAccessSelectionType] READONLY,
@AccessSecretsManager BIT = 0
AS
BEGIN
SET NOCOUNT ON
EXEC [dbo].[OrganizationUser_Update] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager
-- Update
UPDATE
[Target]
SET
[Target].[ReadOnly] = [Source].[ReadOnly],
[Target].[HidePasswords] = [Source].[HidePasswords],
[Target].[Manage] = [Source].[Manage]
FROM
[dbo].[CollectionUser] AS [Target]
INNER JOIN
@Collections AS [Source] ON [Source].[Id] = [Target].[CollectionId]
WHERE
[Target].[OrganizationUserId] = @Id
AND (
[Target].[ReadOnly] != [Source].[ReadOnly]
OR [Target].[HidePasswords] != [Source].[HidePasswords]
OR [Target].[Manage] != [Source].[Manage]
)
-- Insert
INSERT INTO [dbo].[CollectionUser]
(
[CollectionId],
[OrganizationUserId],
[ReadOnly],
[HidePasswords],
[Manage]
)
SELECT
[Source].[Id],
@Id,
[Source].[ReadOnly],
[Source].[HidePasswords],
[Source].[Manage]
FROM
@Collections AS [Source]
INNER JOIN
[dbo].[Collection] C ON C.[Id] = [Source].[Id] AND C.[OrganizationId] = @OrganizationId
WHERE
NOT EXISTS (
SELECT
1
FROM
[dbo].[CollectionUser]
WHERE
[CollectionId] = [Source].[Id]
AND [OrganizationUserId] = @Id
)
-- Delete
DELETE
CU
FROM
[dbo].[CollectionUser] CU
WHERE
CU.[OrganizationUserId] = @Id
AND NOT EXISTS (
SELECT
1
FROM
@Collections
WHERE
[Id] = CU.[CollectionId]
)
END
GO

View File

@ -0,0 +1,45 @@
-- Finalise removal of OrganizationUser.AccessAll column
-- Drop the column
/****************************************************************
*
* WARNING: Index Rebuild on OrganizationUser Table!
* Ensure [IX_OrganizationUser_UserIdOrganizationIdStatus] impact is done after-hours
* or scale DB instance up to handle increased load during update.
*
***************************************************************/
-- Create the new index (without the column) before we drop the old index
PRINT N'Creating index IX_OrganizationUser_UserIdOrganizationIdStatusV2...';
CREATE NONCLUSTERED INDEX [IX_OrganizationUser_UserIdOrganizationIdStatusV2]
ON [dbo].[OrganizationUser]([UserId] ASC, [OrganizationId] ASC, [Status] ASC);
-- Drop the old index that refers to the column
PRINT N'Dropping index IX_OrganizationUser_UserIdOrganizationIdStatus...';
DROP INDEX IF EXISTS [IX_OrganizationUser_UserIdOrganizationIdStatus]
ON [dbo].[OrganizationUser];
-- Drop default constraint
IF OBJECT_ID('[dbo].[DF_OrganizationUser_AccessAll]', 'D') IS NOT NULL
BEGIN
ALTER TABLE [dbo].[OrganizationUser]
DROP CONSTRAINT [DF_OrganizationUser_AccessAll];
END
GO
-- Drop the column
IF COL_LENGTH('[dbo].[OrganizationUser]', 'AccessAll') IS NOT NULL
BEGIN
ALTER TABLE
[dbo].[OrganizationUser]
DROP COLUMN
[AccessAll]
END
GO
-- Refresh views
IF OBJECT_ID('[dbo].[OrganizationUserView]') IS NOT NULL
BEGIN
EXECUTE sp_refreshsqlmodule N'[dbo].[OrganizationUserView]';
END
GO

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations;
/// <inheritdoc />
public partial class DropOrganizationUserAccessAll : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AccessAll",
table: "OrganizationUser");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "AccessAll",
table: "OrganizationUser",
type: "tinyint(1)",
nullable: false,
defaultValue: false);
}
}

View File

@ -1222,11 +1222,6 @@ namespace Bit.MySqlMigrations.Migrations
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("char(36)"); .HasColumnType("char(36)");
b.Property<bool>("AccessAll")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false);
b.Property<bool>("AccessSecretsManager") b.Property<bool>("AccessSecretsManager")
.HasColumnType("tinyint(1)"); .HasColumnType("tinyint(1)");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class DropOrganizationUserAccessAll : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AccessAll",
table: "OrganizationUser");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "AccessAll",
table: "OrganizationUser",
type: "boolean",
nullable: false,
defaultValue: false);
}
}

View File

@ -1227,11 +1227,6 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("uuid"); .HasColumnType("uuid");
b.Property<bool>("AccessAll")
.ValueGeneratedOnAdd()
.HasColumnType("boolean")
.HasDefaultValue(false);
b.Property<bool>("AccessSecretsManager") b.Property<bool>("AccessSecretsManager")
.HasColumnType("boolean"); .HasColumnType("boolean");

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.SqliteMigrations.Migrations;
/// <inheritdoc />
public partial class DropOrganizationUserAccessAll : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AccessAll",
table: "OrganizationUser");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "AccessAll",
table: "OrganizationUser",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
}

View File

@ -1211,11 +1211,6 @@ namespace Bit.SqliteMigrations.Migrations
b.Property<Guid>("Id") b.Property<Guid>("Id")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<bool>("AccessAll")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false);
b.Property<bool>("AccessSecretsManager") b.Property<bool>("AccessSecretsManager")
.HasColumnType("INTEGER"); .HasColumnType("INTEGER");