mirror of
https://github.com/bitwarden/server
synced 2026-01-20 09:23:28 +00:00
* [SG-966] [SG-967] Add new cipher properties, update DB objects and create migrations (#2681) * Updated cipher entity with two new columns * Added sqlserver mifgration and updated applicable stored procedures and table * Added EF Migrations * Made changes to response model to include new column properties * Fixed formatting * Modified scripts to reflect suggestions made on PR * Added column to cipher table using default * Include constraint in create cipher table script * Added key and forcerotatekey property to request model (#2716) * Added key update on the Cipher_UpdateWithCollection stored procedure, ef (#2855) * Added key and forceKeyRotation to BuildCiphersTable method (#2893) * [PM-2211] Remove forceKeyRotation column (#2921) * Removed forceKeyRotation column * Adjusted date for migrtaion file * Passed key column to update cipher script to update cipher key when it is rotated (#2967) * [PM-2448] Update CipherDetails_Update SP to update attachment column (#2992) * Updated the cipherdetails_update stored procedure to update the attachement column when encrypted with the cipher key * Moved migration and renamed old migration file * Fixed lint issues * Fixed lint issues * renamed sqlserver migration to have a more recent date * [PM-2548] Added validation to edit and add attachments methods (#3130) * PM-2548 Added validation to edit and add attachments methods * PM-2548 Moved the validation to a private method * PM-2548 Minor refactor * Bumped up minimum version * Bumped up minimum version * Changed version for tests purposes * Bumped up minimum version * Updated encryption minimum version to match clients for QA. * PM-3976 Passed Key column to update cipher on bulk edit (#3299) * Updated minimum client version in preparation for release. * Renamed migration with current date. (#3303) --------- Co-authored-by: SmithThe4th <gsmith@bitwarden.com> Co-authored-by: gbubemismith <gsmithwalter@gmail.com> Co-authored-by: Carlos Gonçalves <cgoncalves@bitwarden.com> Co-authored-by: Carlos Gonçalves <carlosmaccam@gmail.com>
37 lines
1.3 KiB
Transact-SQL
37 lines
1.3 KiB
Transact-SQL
|
|
CREATE TABLE [dbo].[Cipher] (
|
|
[Id] UNIQUEIDENTIFIER NOT NULL,
|
|
[UserId] UNIQUEIDENTIFIER NULL,
|
|
[OrganizationId] UNIQUEIDENTIFIER NULL,
|
|
[Type] TINYINT NOT NULL,
|
|
[Data] NVARCHAR (MAX) NOT NULL,
|
|
[Favorites] NVARCHAR (MAX) NULL,
|
|
[Folders] NVARCHAR (MAX) NULL,
|
|
[Attachments] NVARCHAR (MAX) NULL,
|
|
[CreationDate] DATETIME2 (7) NOT NULL,
|
|
[RevisionDate] DATETIME2 (7) NOT NULL,
|
|
[DeletedDate] DATETIME2 (7) NULL,
|
|
[Reprompt] TINYINT NULL,
|
|
[Key] VARCHAR(MAX) NULL,
|
|
CONSTRAINT [PK_Cipher] PRIMARY KEY CLUSTERED ([Id] ASC),
|
|
CONSTRAINT [FK_Cipher_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]),
|
|
CONSTRAINT [FK_Cipher_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
|
|
);
|
|
|
|
|
|
GO
|
|
CREATE NONCLUSTERED INDEX [IX_Cipher_UserId_OrganizationId_IncludeAll]
|
|
ON [dbo].[Cipher]([UserId] ASC, [OrganizationId] ASC)
|
|
INCLUDE ([Type], [Data], [Favorites], [Folders], [Attachments], [CreationDate], [RevisionDate], [DeletedDate]);
|
|
|
|
|
|
GO
|
|
CREATE NONCLUSTERED INDEX [IX_Cipher_OrganizationId]
|
|
ON [dbo].[Cipher]([OrganizationId] ASC);
|
|
|
|
|
|
GO
|
|
CREATE NONCLUSTERED INDEX [IX_Cipher_DeletedDate]
|
|
ON [dbo].[Cipher]([DeletedDate] ASC);
|
|
|