mirror of
https://github.com/bitwarden/server
synced 2025-12-27 13:43:18 +00:00
* add GetAllOrganizationCiphersExcludingDefaultUserCollections * add sproc * update sproc and feature flag name * add sproc. update tests * rename sproc * rename sproc * use single sproc * revert change * remove unused code. update sproc * remove joins from proc * update migration filename * fix syntax * fix indentation * remove unnecessary feature flag and go statements. clean up code * update sproc, view, and index * update sproc * update index * update timestamp * update filename. update sproc to match EF filter * match only enabled organizations. make index creation idempotent * update file timestamp * update timestamp * use square brackets * add square brackets * formatting fixes * rename view * remove index
38 lines
1.3 KiB
Transact-SQL
38 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);
|
|
|
|
GO
|