mirror of
https://github.com/bitwarden/server
synced 2025-12-30 07:03:42 +00:00
[SM-1591] Adding SecretVersion table to server (#6406)
* Adding SecretVersion table to server * making the names singular not plural for new table * removing migration * fixing migration * Adding indexes for serviceacct and orguserId * indexes for sqllite * fixing migrations * adding indexes to secretVeriosn.sql * tests * removing tests * adding GO
This commit is contained in:
27
src/Sql/dbo/SecretsManager/Tables/SecretVersion.sql
Normal file
27
src/Sql/dbo/SecretsManager/Tables/SecretVersion.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
CREATE TABLE [dbo].[SecretVersion] (
|
||||
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||
[SecretId] UNIQUEIDENTIFIER NOT NULL,
|
||||
[Value] NVARCHAR (MAX) NOT NULL,
|
||||
[VersionDate] DATETIME2 (7) NOT NULL,
|
||||
[EditorServiceAccountId] UNIQUEIDENTIFIER NULL,
|
||||
[EditorOrganizationUserId] UNIQUEIDENTIFIER NULL,
|
||||
CONSTRAINT [PK_SecretVersion] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_SecretVersion_OrganizationUser] FOREIGN KEY ([EditorOrganizationUserId]) REFERENCES [dbo].[OrganizationUser] ([Id]) ON DELETE SET NULL,
|
||||
CONSTRAINT [FK_SecretVersion_Secret] FOREIGN KEY ([SecretId]) REFERENCES [dbo].[Secret] ([Id]) ON DELETE CASCADE,
|
||||
CONSTRAINT [FK_SecretVersion_ServiceAccount] FOREIGN KEY ([EditorServiceAccountId]) REFERENCES [dbo].[ServiceAccount] ([Id]) ON DELETE SET NULL
|
||||
);
|
||||
|
||||
GO
|
||||
CREATE NONCLUSTERED INDEX [IX_SecretVersion_SecretId]
|
||||
ON [dbo].[SecretVersion]([SecretId] ASC);
|
||||
|
||||
GO
|
||||
CREATE NONCLUSTERED INDEX [IX_SecretVersion_EditorServiceAccountId]
|
||||
ON [dbo].[SecretVersion]([EditorServiceAccountId] ASC)
|
||||
WHERE [EditorServiceAccountId] IS NOT NULL;
|
||||
|
||||
GO
|
||||
CREATE NONCLUSTERED INDEX [IX_SecretVersion_EditorOrganizationUserId]
|
||||
ON [dbo].[SecretVersion]([EditorOrganizationUserId] ASC)
|
||||
WHERE [EditorOrganizationUserId] IS NOT NULL;
|
||||
GO
|
||||
Reference in New Issue
Block a user